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,200 | symfony/symfony | src/Symfony/Component/Translation/Writer/TranslationWriter.php | TranslationWriter.disableBackup | public function disableBackup()
{
@trigger_error(sprintf('The "%s()" method is deprecated since Symfony 4.1.', __METHOD__), E_USER_DEPRECATED);
foreach ($this->dumpers as $dumper) {
if (method_exists($dumper, 'setBackup')) {
$dumper->setBackup(false);
}
... | php | public function disableBackup()
{
@trigger_error(sprintf('The "%s()" method is deprecated since Symfony 4.1.', __METHOD__), E_USER_DEPRECATED);
foreach ($this->dumpers as $dumper) {
if (method_exists($dumper, 'setBackup')) {
$dumper->setBackup(false);
}
... | [
"public",
"function",
"disableBackup",
"(",
")",
"{",
"@",
"trigger_error",
"(",
"sprintf",
"(",
"'The \"%s()\" method is deprecated since Symfony 4.1.'",
",",
"__METHOD__",
")",
",",
"E_USER_DEPRECATED",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"dumpers",
"as",... | Disables dumper backup.
@deprecated since Symfony 4.1 | [
"Disables",
"dumper",
"backup",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Translation/Writer/TranslationWriter.php#L44-L53 |
207,201 | symfony/symfony | src/Symfony/Component/Translation/Writer/TranslationWriter.php | TranslationWriter.write | public function write(MessageCatalogue $catalogue, $format, $options = [])
{
if (!isset($this->dumpers[$format])) {
throw new InvalidArgumentException(sprintf('There is no dumper associated with format "%s".', $format));
}
// get the right dumper
$dumper = $this->dumpers... | php | public function write(MessageCatalogue $catalogue, $format, $options = [])
{
if (!isset($this->dumpers[$format])) {
throw new InvalidArgumentException(sprintf('There is no dumper associated with format "%s".', $format));
}
// get the right dumper
$dumper = $this->dumpers... | [
"public",
"function",
"write",
"(",
"MessageCatalogue",
"$",
"catalogue",
",",
"$",
"format",
",",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"dumpers",
"[",
"$",
"format",
"]",
")",
")",
"{",
"throw",... | Writes translation from the catalogue according to the selected format.
@param MessageCatalogue $catalogue The message catalogue to write
@param string $format The format to use to dump the messages
@param array $options Options that are passed to the dumper
@throws InvalidArgumentException | [
"Writes",
"translation",
"from",
"the",
"catalogue",
"according",
"to",
"the",
"selected",
"format",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Translation/Writer/TranslationWriter.php#L74-L89 |
207,202 | symfony/symfony | src/Symfony/Component/Asset/UrlPackage.php | UrlPackage.getBaseUrl | public function getBaseUrl($path)
{
if (1 === \count($this->baseUrls)) {
return $this->baseUrls[0];
}
return $this->baseUrls[$this->chooseBaseUrl($path)];
} | php | public function getBaseUrl($path)
{
if (1 === \count($this->baseUrls)) {
return $this->baseUrls[0];
}
return $this->baseUrls[$this->chooseBaseUrl($path)];
} | [
"public",
"function",
"getBaseUrl",
"(",
"$",
"path",
")",
"{",
"if",
"(",
"1",
"===",
"\\",
"count",
"(",
"$",
"this",
"->",
"baseUrls",
")",
")",
"{",
"return",
"$",
"this",
"->",
"baseUrls",
"[",
"0",
"]",
";",
"}",
"return",
"$",
"this",
"->"... | Returns the base URL for a path.
@param string $path
@return string The base URL | [
"Returns",
"the",
"base",
"URL",
"for",
"a",
"path",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Asset/UrlPackage.php#L102-L109 |
207,203 | symfony/symfony | src/Symfony/Component/Asset/UrlPackage.php | UrlPackage.chooseBaseUrl | protected function chooseBaseUrl($path)
{
return (int) fmod(hexdec(substr(hash('sha256', $path), 0, 10)), \count($this->baseUrls));
} | php | protected function chooseBaseUrl($path)
{
return (int) fmod(hexdec(substr(hash('sha256', $path), 0, 10)), \count($this->baseUrls));
} | [
"protected",
"function",
"chooseBaseUrl",
"(",
"$",
"path",
")",
"{",
"return",
"(",
"int",
")",
"fmod",
"(",
"hexdec",
"(",
"substr",
"(",
"hash",
"(",
"'sha256'",
",",
"$",
"path",
")",
",",
"0",
",",
"10",
")",
")",
",",
"\\",
"count",
"(",
"$... | Determines which base URL to use for the given path.
Override this method to change the default distribution strategy.
This method should always return the same base URL index for a given path.
@param string $path
@return int The base URL index for the given path | [
"Determines",
"which",
"base",
"URL",
"to",
"use",
"for",
"the",
"given",
"path",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Asset/UrlPackage.php#L121-L124 |
207,204 | symfony/symfony | src/Symfony/Component/HttpKernel/DataCollector/DataCollector.php | DataCollector.cloneVar | protected function cloneVar($var)
{
if ($var instanceof Data) {
return $var;
}
if (null === $this->cloner) {
if (!class_exists(CutStub::class)) {
throw new \LogicException(sprintf('The VarDumper component is needed for the %s() method. Install symfony/... | php | protected function cloneVar($var)
{
if ($var instanceof Data) {
return $var;
}
if (null === $this->cloner) {
if (!class_exists(CutStub::class)) {
throw new \LogicException(sprintf('The VarDumper component is needed for the %s() method. Install symfony/... | [
"protected",
"function",
"cloneVar",
"(",
"$",
"var",
")",
"{",
"if",
"(",
"$",
"var",
"instanceof",
"Data",
")",
"{",
"return",
"$",
"var",
";",
"}",
"if",
"(",
"null",
"===",
"$",
"this",
"->",
"cloner",
")",
"{",
"if",
"(",
"!",
"class_exists",
... | Converts the variable into a serializable Data instance.
This array can be displayed in the template using
the VarDumper component.
@param mixed $var
@return Data | [
"Converts",
"the",
"variable",
"into",
"a",
"serializable",
"Data",
"instance",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/HttpKernel/DataCollector/DataCollector.php#L71-L86 |
207,205 | symfony/symfony | src/Symfony/Component/Console/Helper/TableStyle.php | TableStyle.setHorizontalBorderChars | public function setHorizontalBorderChars(string $outside, string $inside = null): self
{
$this->horizontalOutsideBorderChar = $outside;
$this->horizontalInsideBorderChar = $inside ?? $outside;
return $this;
} | php | public function setHorizontalBorderChars(string $outside, string $inside = null): self
{
$this->horizontalOutsideBorderChar = $outside;
$this->horizontalInsideBorderChar = $inside ?? $outside;
return $this;
} | [
"public",
"function",
"setHorizontalBorderChars",
"(",
"string",
"$",
"outside",
",",
"string",
"$",
"inside",
"=",
"null",
")",
":",
"self",
"{",
"$",
"this",
"->",
"horizontalOutsideBorderChar",
"=",
"$",
"outside",
";",
"$",
"this",
"->",
"horizontalInsideB... | Sets horizontal border characters.
<code>
βββββββββββββββββ€βββββββββββββββββββββββββββ€βββββββββββββββββββ
1 ISBN 2 Title β Author β
β ββββββββββββββββͺβββββββββββββββββββββββββββͺβββββββββββββββββββ£
β 99921-58-10-7 β Divine Comedy β Dante Alighieri β
β 9971-5-0210-0 β A T... | [
"Sets",
"horizontal",
"border",
"characters",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Console/Helper/TableStyle.php#L96-L102 |
207,206 | symfony/symfony | src/Symfony/Component/Console/Helper/TableStyle.php | TableStyle.setHorizontalBorderChar | public function setHorizontalBorderChar($horizontalBorderChar)
{
@trigger_error(sprintf('The "%s()" method is deprecated since Symfony 4.1, use setHorizontalBorderChars() instead.', __METHOD__), E_USER_DEPRECATED);
return $this->setHorizontalBorderChars($horizontalBorderChar, $horizontalBorderChar)... | php | public function setHorizontalBorderChar($horizontalBorderChar)
{
@trigger_error(sprintf('The "%s()" method is deprecated since Symfony 4.1, use setHorizontalBorderChars() instead.', __METHOD__), E_USER_DEPRECATED);
return $this->setHorizontalBorderChars($horizontalBorderChar, $horizontalBorderChar)... | [
"public",
"function",
"setHorizontalBorderChar",
"(",
"$",
"horizontalBorderChar",
")",
"{",
"@",
"trigger_error",
"(",
"sprintf",
"(",
"'The \"%s()\" method is deprecated since Symfony 4.1, use setHorizontalBorderChars() instead.'",
",",
"__METHOD__",
")",
",",
"E_USER_DEPRECATE... | Sets horizontal border character.
@param string $horizontalBorderChar
@return $this
@deprecated since Symfony 4.1, use {@link setHorizontalBorderChars()} instead. | [
"Sets",
"horizontal",
"border",
"character",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Console/Helper/TableStyle.php#L113-L118 |
207,207 | symfony/symfony | src/Symfony/Component/Console/Helper/TableStyle.php | TableStyle.setVerticalBorderChars | public function setVerticalBorderChars(string $outside, string $inside = null): self
{
$this->verticalOutsideBorderChar = $outside;
$this->verticalInsideBorderChar = $inside ?? $outside;
return $this;
} | php | public function setVerticalBorderChars(string $outside, string $inside = null): self
{
$this->verticalOutsideBorderChar = $outside;
$this->verticalInsideBorderChar = $inside ?? $outside;
return $this;
} | [
"public",
"function",
"setVerticalBorderChars",
"(",
"string",
"$",
"outside",
",",
"string",
"$",
"inside",
"=",
"null",
")",
":",
"self",
"{",
"$",
"this",
"->",
"verticalOutsideBorderChar",
"=",
"$",
"outside",
";",
"$",
"this",
"->",
"verticalInsideBorderC... | Sets vertical border characters.
<code>
βββββββββββββββββ€βββββββββββββββββββββββββββ€βββββββββββββββββββ
β ISBN β Title β Author β
β βββββββ1ββββββββͺβββββββββββββββββββββββββββͺβββββββββββββββββββ£
β 99921-58-10-7 β Divine Comedy β Dante Alighieri β
β 9971-5-0210-0 β A Tal... | [
"Sets",
"vertical",
"border",
"characters",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Console/Helper/TableStyle.php#L152-L158 |
207,208 | symfony/symfony | src/Symfony/Component/Console/Helper/TableStyle.php | TableStyle.setVerticalBorderChar | public function setVerticalBorderChar($verticalBorderChar)
{
@trigger_error(sprintf('The "%s()" method is deprecated since Symfony 4.1, use setVerticalBorderChars() instead.', __METHOD__), E_USER_DEPRECATED);
return $this->setVerticalBorderChars($verticalBorderChar, $verticalBorderChar);
} | php | public function setVerticalBorderChar($verticalBorderChar)
{
@trigger_error(sprintf('The "%s()" method is deprecated since Symfony 4.1, use setVerticalBorderChars() instead.', __METHOD__), E_USER_DEPRECATED);
return $this->setVerticalBorderChars($verticalBorderChar, $verticalBorderChar);
} | [
"public",
"function",
"setVerticalBorderChar",
"(",
"$",
"verticalBorderChar",
")",
"{",
"@",
"trigger_error",
"(",
"sprintf",
"(",
"'The \"%s()\" method is deprecated since Symfony 4.1, use setVerticalBorderChars() instead.'",
",",
"__METHOD__",
")",
",",
"E_USER_DEPRECATED",
... | Sets vertical border character.
@param string $verticalBorderChar
@return $this
@deprecated since Symfony 4.1, use {@link setVerticalBorderChars()} instead. | [
"Sets",
"vertical",
"border",
"character",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Console/Helper/TableStyle.php#L169-L174 |
207,209 | symfony/symfony | src/Symfony/Component/Console/Helper/TableStyle.php | TableStyle.setCrossingChars | public function setCrossingChars(string $cross, string $topLeft, string $topMid, string $topRight, string $midRight, string $bottomRight, string $bottomMid, string $bottomLeft, string $midLeft, string $topLeftBottom = null, string $topMidBottom = null, string $topRightBottom = null): self
{
$this->crossingC... | php | public function setCrossingChars(string $cross, string $topLeft, string $topMid, string $topRight, string $midRight, string $bottomRight, string $bottomMid, string $bottomLeft, string $midLeft, string $topLeftBottom = null, string $topMidBottom = null, string $topRightBottom = null): self
{
$this->crossingC... | [
"public",
"function",
"setCrossingChars",
"(",
"string",
"$",
"cross",
",",
"string",
"$",
"topLeft",
",",
"string",
"$",
"topMid",
",",
"string",
"$",
"topRight",
",",
"string",
"$",
"midRight",
",",
"string",
"$",
"bottomRight",
",",
"string",
"$",
"bott... | Sets crossing characters.
Example:
<code>
1βββββββββββββββ2ββββββββββββββββββββββββββ2ββββββββββββββββββ3
β ISBN β Title β Author β
8'ββββββββββββββ0'βββββββββββββββββββββββββ0'βββββββββββββββββ4'
β 99921-58-10-7 β Divine Comedy β Dante Alighieri β
β 9971-5-0210-0 β A ... | [
"Sets",
"crossing",
"characters",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Console/Helper/TableStyle.php#L234-L250 |
207,210 | symfony/symfony | src/Symfony/Component/Console/Helper/TableStyle.php | TableStyle.setDefaultCrossingChar | public function setDefaultCrossingChar(string $char): self
{
return $this->setCrossingChars($char, $char, $char, $char, $char, $char, $char, $char, $char);
} | php | public function setDefaultCrossingChar(string $char): self
{
return $this->setCrossingChars($char, $char, $char, $char, $char, $char, $char, $char, $char);
} | [
"public",
"function",
"setDefaultCrossingChar",
"(",
"string",
"$",
"char",
")",
":",
"self",
"{",
"return",
"$",
"this",
"->",
"setCrossingChars",
"(",
"$",
"char",
",",
"$",
"char",
",",
"$",
"char",
",",
"$",
"char",
",",
"$",
"char",
",",
"$",
"c... | Sets default crossing character used for each cross.
@see {@link setCrossingChars()} for setting each crossing individually. | [
"Sets",
"default",
"crossing",
"character",
"used",
"for",
"each",
"cross",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Console/Helper/TableStyle.php#L257-L260 |
207,211 | symfony/symfony | src/Symfony/Component/Console/Helper/TableStyle.php | TableStyle.getCrossingChars | public function getCrossingChars(): array
{
return [
$this->crossingChar,
$this->crossingTopLeftChar,
$this->crossingTopMidChar,
$this->crossingTopRightChar,
$this->crossingMidRightChar,
$this->crossingBottomRightChar,
$this... | php | public function getCrossingChars(): array
{
return [
$this->crossingChar,
$this->crossingTopLeftChar,
$this->crossingTopMidChar,
$this->crossingTopRightChar,
$this->crossingMidRightChar,
$this->crossingBottomRightChar,
$this... | [
"public",
"function",
"getCrossingChars",
"(",
")",
":",
"array",
"{",
"return",
"[",
"$",
"this",
"->",
"crossingChar",
",",
"$",
"this",
"->",
"crossingTopLeftChar",
",",
"$",
"this",
"->",
"crossingTopMidChar",
",",
"$",
"this",
"->",
"crossingTopRightChar"... | Gets crossing characters.
@internal | [
"Gets",
"crossing",
"characters",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Console/Helper/TableStyle.php#L293-L309 |
207,212 | symfony/symfony | src/Symfony/Component/Console/Helper/TableStyle.php | TableStyle.setPadType | public function setPadType($padType)
{
if (!\in_array($padType, [STR_PAD_LEFT, STR_PAD_RIGHT, STR_PAD_BOTH], true)) {
throw new InvalidArgumentException('Invalid padding type. Expected one of (STR_PAD_LEFT, STR_PAD_RIGHT, STR_PAD_BOTH).');
}
$this->padType = $padType;
r... | php | public function setPadType($padType)
{
if (!\in_array($padType, [STR_PAD_LEFT, STR_PAD_RIGHT, STR_PAD_BOTH], true)) {
throw new InvalidArgumentException('Invalid padding type. Expected one of (STR_PAD_LEFT, STR_PAD_RIGHT, STR_PAD_BOTH).');
}
$this->padType = $padType;
r... | [
"public",
"function",
"setPadType",
"(",
"$",
"padType",
")",
"{",
"if",
"(",
"!",
"\\",
"in_array",
"(",
"$",
"padType",
",",
"[",
"STR_PAD_LEFT",
",",
"STR_PAD_RIGHT",
",",
"STR_PAD_BOTH",
"]",
",",
"true",
")",
")",
"{",
"throw",
"new",
"InvalidArgume... | Sets cell padding type.
@param int $padType STR_PAD_*
@return $this | [
"Sets",
"cell",
"padding",
"type",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Console/Helper/TableStyle.php#L414-L423 |
207,213 | symfony/symfony | src/Symfony/Component/HttpKernel/DependencyInjection/AddAnnotatedClassesToCachePass.php | AddAnnotatedClassesToCachePass.expandClasses | private function expandClasses(array $patterns, array $classes)
{
$expanded = [];
// Explicit classes declared in the patterns are returned directly
foreach ($patterns as $key => $pattern) {
if ('\\' !== substr($pattern, -1) && false === strpos($pattern, '*')) {
... | php | private function expandClasses(array $patterns, array $classes)
{
$expanded = [];
// Explicit classes declared in the patterns are returned directly
foreach ($patterns as $key => $pattern) {
if ('\\' !== substr($pattern, -1) && false === strpos($pattern, '*')) {
... | [
"private",
"function",
"expandClasses",
"(",
"array",
"$",
"patterns",
",",
"array",
"$",
"classes",
")",
"{",
"$",
"expanded",
"=",
"[",
"]",
";",
"// Explicit classes declared in the patterns are returned directly",
"foreach",
"(",
"$",
"patterns",
"as",
"$",
"k... | Expands the given class patterns using a list of existing classes.
@param array $patterns The class patterns to expand
@param array $classes The existing classes to match against the patterns
@return array A list of classes derived from the patterns | [
"Expands",
"the",
"given",
"class",
"patterns",
"using",
"a",
"list",
"of",
"existing",
"classes",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/HttpKernel/DependencyInjection/AddAnnotatedClassesToCachePass.php#L60-L84 |
207,214 | symfony/symfony | src/Symfony/Component/CssSelector/Parser/TokenStream.php | TokenStream.getNext | public function getNext()
{
if ($this->peeking) {
$this->peeking = false;
$this->used[] = $this->peeked;
return $this->peeked;
}
if (!isset($this->tokens[$this->cursor])) {
throw new InternalErrorException('Unexpected token stream end.');
... | php | public function getNext()
{
if ($this->peeking) {
$this->peeking = false;
$this->used[] = $this->peeked;
return $this->peeked;
}
if (!isset($this->tokens[$this->cursor])) {
throw new InternalErrorException('Unexpected token stream end.');
... | [
"public",
"function",
"getNext",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"peeking",
")",
"{",
"$",
"this",
"->",
"peeking",
"=",
"false",
";",
"$",
"this",
"->",
"used",
"[",
"]",
"=",
"$",
"this",
"->",
"peeked",
";",
"return",
"$",
"this",... | Returns next token.
@return Token
@throws InternalErrorException If there is no more token | [
"Returns",
"next",
"token",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/CssSelector/Parser/TokenStream.php#L83-L97 |
207,215 | symfony/symfony | src/Symfony/Component/CssSelector/Parser/TokenStream.php | TokenStream.getPeek | public function getPeek()
{
if (!$this->peeking) {
$this->peeked = $this->getNext();
$this->peeking = true;
}
return $this->peeked;
} | php | public function getPeek()
{
if (!$this->peeking) {
$this->peeked = $this->getNext();
$this->peeking = true;
}
return $this->peeked;
} | [
"public",
"function",
"getPeek",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"peeking",
")",
"{",
"$",
"this",
"->",
"peeked",
"=",
"$",
"this",
"->",
"getNext",
"(",
")",
";",
"$",
"this",
"->",
"peeking",
"=",
"true",
";",
"}",
"return",
... | Returns peeked token.
@return Token | [
"Returns",
"peeked",
"token",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/CssSelector/Parser/TokenStream.php#L104-L112 |
207,216 | symfony/symfony | src/Symfony/Component/CssSelector/Parser/TokenStream.php | TokenStream.getNextIdentifier | public function getNextIdentifier()
{
$next = $this->getNext();
if (!$next->isIdentifier()) {
throw SyntaxErrorException::unexpectedToken('identifier', $next);
}
return $next->getValue();
} | php | public function getNextIdentifier()
{
$next = $this->getNext();
if (!$next->isIdentifier()) {
throw SyntaxErrorException::unexpectedToken('identifier', $next);
}
return $next->getValue();
} | [
"public",
"function",
"getNextIdentifier",
"(",
")",
"{",
"$",
"next",
"=",
"$",
"this",
"->",
"getNext",
"(",
")",
";",
"if",
"(",
"!",
"$",
"next",
"->",
"isIdentifier",
"(",
")",
")",
"{",
"throw",
"SyntaxErrorException",
"::",
"unexpectedToken",
"(",... | Returns nex identifier token.
@return string The identifier token value
@throws SyntaxErrorException If next token is not an identifier | [
"Returns",
"nex",
"identifier",
"token",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/CssSelector/Parser/TokenStream.php#L131-L140 |
207,217 | symfony/symfony | src/Symfony/Component/CssSelector/Parser/TokenStream.php | TokenStream.getNextIdentifierOrStar | public function getNextIdentifierOrStar()
{
$next = $this->getNext();
if ($next->isIdentifier()) {
return $next->getValue();
}
if ($next->isDelimiter(['*'])) {
return;
}
throw SyntaxErrorException::unexpectedToken('identifier or "*"', $next)... | php | public function getNextIdentifierOrStar()
{
$next = $this->getNext();
if ($next->isIdentifier()) {
return $next->getValue();
}
if ($next->isDelimiter(['*'])) {
return;
}
throw SyntaxErrorException::unexpectedToken('identifier or "*"', $next)... | [
"public",
"function",
"getNextIdentifierOrStar",
"(",
")",
"{",
"$",
"next",
"=",
"$",
"this",
"->",
"getNext",
"(",
")",
";",
"if",
"(",
"$",
"next",
"->",
"isIdentifier",
"(",
")",
")",
"{",
"return",
"$",
"next",
"->",
"getValue",
"(",
")",
";",
... | Returns nex identifier or star delimiter token.
@return string|null The identifier token value or null if star found
@throws SyntaxErrorException If next token is not an identifier or a star delimiter | [
"Returns",
"nex",
"identifier",
"or",
"star",
"delimiter",
"token",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/CssSelector/Parser/TokenStream.php#L149-L162 |
207,218 | symfony/symfony | src/Symfony/Component/Routing/RequestContext.php | RequestContext.fromRequest | public function fromRequest(Request $request)
{
$this->setBaseUrl($request->getBaseUrl());
$this->setPathInfo($request->getPathInfo());
$this->setMethod($request->getMethod());
$this->setHost($request->getHost());
$this->setScheme($request->getScheme());
$this->setHtt... | php | public function fromRequest(Request $request)
{
$this->setBaseUrl($request->getBaseUrl());
$this->setPathInfo($request->getPathInfo());
$this->setMethod($request->getMethod());
$this->setHost($request->getHost());
$this->setScheme($request->getScheme());
$this->setHtt... | [
"public",
"function",
"fromRequest",
"(",
"Request",
"$",
"request",
")",
"{",
"$",
"this",
"->",
"setBaseUrl",
"(",
"$",
"request",
"->",
"getBaseUrl",
"(",
")",
")",
";",
"$",
"this",
"->",
"setPathInfo",
"(",
"$",
"request",
"->",
"getPathInfo",
"(",
... | Updates the RequestContext information based on a HttpFoundation Request.
@return $this | [
"Updates",
"the",
"RequestContext",
"information",
"based",
"on",
"a",
"HttpFoundation",
"Request",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Routing/RequestContext.php#L53-L65 |
207,219 | symfony/symfony | src/Symfony/Bundle/FrameworkBundle/Command/ConfigDebugCommand.php | ConfigDebugCommand.getConfigForPath | private function getConfigForPath(array $config, string $path, string $alias)
{
$steps = explode('.', $path);
foreach ($steps as $step) {
if (!\array_key_exists($step, $config)) {
throw new LogicException(sprintf('Unable to find configuration for "%s.%s"', $alias, $path)... | php | private function getConfigForPath(array $config, string $path, string $alias)
{
$steps = explode('.', $path);
foreach ($steps as $step) {
if (!\array_key_exists($step, $config)) {
throw new LogicException(sprintf('Unable to find configuration for "%s.%s"', $alias, $path)... | [
"private",
"function",
"getConfigForPath",
"(",
"array",
"$",
"config",
",",
"string",
"$",
"path",
",",
"string",
"$",
"alias",
")",
"{",
"$",
"steps",
"=",
"explode",
"(",
"'.'",
",",
"$",
"path",
")",
";",
"foreach",
"(",
"$",
"steps",
"as",
"$",
... | Iterate over configuration until the last step of the given path.
@throws LogicException If the configuration does not exist
@return mixed | [
"Iterate",
"over",
"configuration",
"until",
"the",
"last",
"step",
"of",
"the",
"given",
"path",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Bundle/FrameworkBundle/Command/ConfigDebugCommand.php#L140-L153 |
207,220 | symfony/symfony | src/Symfony/Component/Console/Output/ConsoleOutput.php | ConsoleOutput.section | public function section(): ConsoleSectionOutput
{
return new ConsoleSectionOutput($this->getStream(), $this->consoleSectionOutputs, $this->getVerbosity(), $this->isDecorated(), $this->getFormatter());
} | php | public function section(): ConsoleSectionOutput
{
return new ConsoleSectionOutput($this->getStream(), $this->consoleSectionOutputs, $this->getVerbosity(), $this->isDecorated(), $this->getFormatter());
} | [
"public",
"function",
"section",
"(",
")",
":",
"ConsoleSectionOutput",
"{",
"return",
"new",
"ConsoleSectionOutput",
"(",
"$",
"this",
"->",
"getStream",
"(",
")",
",",
"$",
"this",
"->",
"consoleSectionOutputs",
",",
"$",
"this",
"->",
"getVerbosity",
"(",
... | Creates a new output section. | [
"Creates",
"a",
"new",
"output",
"section",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Console/Output/ConsoleOutput.php#L55-L58 |
207,221 | symfony/symfony | src/Symfony/Component/HttpClient/Response/ResponseTrait.php | ResponseTrait.doDestruct | private function doDestruct()
{
if ($this->initializer && null === $this->info['error']) {
($this->initializer)($this);
$this->initializer = null;
$this->checkStatusCode();
}
} | php | private function doDestruct()
{
if ($this->initializer && null === $this->info['error']) {
($this->initializer)($this);
$this->initializer = null;
$this->checkStatusCode();
}
} | [
"private",
"function",
"doDestruct",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"initializer",
"&&",
"null",
"===",
"$",
"this",
"->",
"info",
"[",
"'error'",
"]",
")",
"{",
"(",
"$",
"this",
"->",
"initializer",
")",
"(",
"$",
"this",
")",
";",
... | Ensures the request is always sent and that the response code was checked. | [
"Ensures",
"the",
"request",
"is",
"always",
"sent",
"and",
"that",
"the",
"response",
"code",
"was",
"checked",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/HttpClient/Response/ResponseTrait.php#L228-L235 |
207,222 | symfony/symfony | src/Symfony/Component/Validator/Util/PropertyPath.php | PropertyPath.append | public static function append($basePath, $subPath)
{
if ('' !== (string) $subPath) {
if ('[' === $subPath[0]) {
return $basePath.$subPath;
}
return '' !== (string) $basePath ? $basePath.'.'.$subPath : $subPath;
}
return $basePath;
} | php | public static function append($basePath, $subPath)
{
if ('' !== (string) $subPath) {
if ('[' === $subPath[0]) {
return $basePath.$subPath;
}
return '' !== (string) $basePath ? $basePath.'.'.$subPath : $subPath;
}
return $basePath;
} | [
"public",
"static",
"function",
"append",
"(",
"$",
"basePath",
",",
"$",
"subPath",
")",
"{",
"if",
"(",
"''",
"!==",
"(",
"string",
")",
"$",
"subPath",
")",
"{",
"if",
"(",
"'['",
"===",
"$",
"subPath",
"[",
"0",
"]",
")",
"{",
"return",
"$",
... | Appends a path to a given property path.
If the base path is empty, the appended path will be returned unchanged.
If the base path is not empty, and the appended path starts with a
squared opening bracket ("["), the concatenation of the two paths is
returned. Otherwise, the concatenation of the two paths is returned,
... | [
"Appends",
"a",
"path",
"to",
"a",
"given",
"property",
"path",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Validator/Util/PropertyPath.php#L37-L48 |
207,223 | symfony/symfony | src/Symfony/Component/BrowserKit/Cookie.php | Cookie.fromString | public static function fromString($cookie, $url = null)
{
$parts = explode(';', $cookie);
if (false === strpos($parts[0], '=')) {
throw new \InvalidArgumentException(sprintf('The cookie string "%s" is not valid.', $parts[0]));
}
list($name, $value) = explode('=', array_... | php | public static function fromString($cookie, $url = null)
{
$parts = explode(';', $cookie);
if (false === strpos($parts[0], '=')) {
throw new \InvalidArgumentException(sprintf('The cookie string "%s" is not valid.', $parts[0]));
}
list($name, $value) = explode('=', array_... | [
"public",
"static",
"function",
"fromString",
"(",
"$",
"cookie",
",",
"$",
"url",
"=",
"null",
")",
"{",
"$",
"parts",
"=",
"explode",
"(",
"';'",
",",
"$",
"cookie",
")",
";",
"if",
"(",
"false",
"===",
"strpos",
"(",
"$",
"parts",
"[",
"0",
"]... | Creates a Cookie instance from a Set-Cookie header value.
@param string $cookie A Set-Cookie header value
@param string|null $url The base URL
@return static
@throws \InvalidArgumentException | [
"Creates",
"a",
"Cookie",
"instance",
"from",
"a",
"Set",
"-",
"Cookie",
"header",
"value",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/BrowserKit/Cookie.php#L129-L200 |
207,224 | symfony/symfony | src/Symfony/Component/Form/Extension/Core/Type/ChoiceType.php | ChoiceType.addSubForms | private function addSubForms(FormBuilderInterface $builder, array $choiceViews, array $options)
{
foreach ($choiceViews as $name => $choiceView) {
// Flatten groups
if (\is_array($choiceView)) {
$this->addSubForms($builder, $choiceView, $options);
cont... | php | private function addSubForms(FormBuilderInterface $builder, array $choiceViews, array $options)
{
foreach ($choiceViews as $name => $choiceView) {
// Flatten groups
if (\is_array($choiceView)) {
$this->addSubForms($builder, $choiceView, $options);
cont... | [
"private",
"function",
"addSubForms",
"(",
"FormBuilderInterface",
"$",
"builder",
",",
"array",
"$",
"choiceViews",
",",
"array",
"$",
"options",
")",
"{",
"foreach",
"(",
"$",
"choiceViews",
"as",
"$",
"name",
"=>",
"$",
"choiceView",
")",
"{",
"// Flatten... | Adds the sub fields for an expanded choice field. | [
"Adds",
"the",
"sub",
"fields",
"for",
"an",
"expanded",
"choice",
"field",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Form/Extension/Core/Type/ChoiceType.php#L347-L363 |
207,225 | symfony/symfony | src/Symfony/Bridge/Doctrine/DependencyInjection/CompilerPass/RegisterMappingsPass.php | RegisterMappingsPass.process | public function process(ContainerBuilder $container)
{
if (!$this->enabled($container)) {
return;
}
$mappingDriverDef = $this->getDriver($container);
$chainDriverDefService = $this->getChainDriverServiceName($container);
// Definition for a Doctrine\Common\Persis... | php | public function process(ContainerBuilder $container)
{
if (!$this->enabled($container)) {
return;
}
$mappingDriverDef = $this->getDriver($container);
$chainDriverDefService = $this->getChainDriverServiceName($container);
// Definition for a Doctrine\Common\Persis... | [
"public",
"function",
"process",
"(",
"ContainerBuilder",
"$",
"container",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"enabled",
"(",
"$",
"container",
")",
")",
"{",
"return",
";",
"}",
"$",
"mappingDriverDef",
"=",
"$",
"this",
"->",
"getDriver",
... | Register mappings and alias with the metadata drivers. | [
"Register",
"mappings",
"and",
"alias",
"with",
"the",
"metadata",
"drivers",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Bridge/Doctrine/DependencyInjection/CompilerPass/RegisterMappingsPass.php#L138-L162 |
207,226 | symfony/symfony | src/Symfony/Bridge/Doctrine/DependencyInjection/CompilerPass/RegisterMappingsPass.php | RegisterMappingsPass.getManagerName | private function getManagerName(ContainerBuilder $container)
{
foreach ($this->managerParameters as $param) {
if ($container->hasParameter($param)) {
$name = $container->getParameter($param);
if ($name) {
return $name;
}
... | php | private function getManagerName(ContainerBuilder $container)
{
foreach ($this->managerParameters as $param) {
if ($container->hasParameter($param)) {
$name = $container->getParameter($param);
if ($name) {
return $name;
}
... | [
"private",
"function",
"getManagerName",
"(",
"ContainerBuilder",
"$",
"container",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"managerParameters",
"as",
"$",
"param",
")",
"{",
"if",
"(",
"$",
"container",
"->",
"hasParameter",
"(",
"$",
"param",
")",
"... | Determine the manager name.
The default implementation loops over the managerParameters and returns
the first non-empty parameter.
@return string The name of the active manager
@throws InvalidArgumentException if none of the managerParameters is found in the container | [
"Determine",
"the",
"manager",
"name",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Bridge/Doctrine/DependencyInjection/CompilerPass/RegisterMappingsPass.php#L214-L229 |
207,227 | symfony/symfony | src/Symfony/Component/Translation/LoggingTranslator.php | LoggingTranslator.log | private function log($id, $domain, $locale)
{
if (null === $domain) {
$domain = 'messages';
}
$id = (string) $id;
$catalogue = $this->translator->getCatalogue($locale);
if ($catalogue->defines($id, $domain)) {
return;
}
if ($catalogue... | php | private function log($id, $domain, $locale)
{
if (null === $domain) {
$domain = 'messages';
}
$id = (string) $id;
$catalogue = $this->translator->getCatalogue($locale);
if ($catalogue->defines($id, $domain)) {
return;
}
if ($catalogue... | [
"private",
"function",
"log",
"(",
"$",
"id",
",",
"$",
"domain",
",",
"$",
"locale",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"domain",
")",
"{",
"$",
"domain",
"=",
"'messages'",
";",
"}",
"$",
"id",
"=",
"(",
"string",
")",
"$",
"id",
";",
... | Logs for missing translations.
@param string $id
@param string|null $domain
@param string|null $locale | [
"Logs",
"for",
"missing",
"translations",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Translation/LoggingTranslator.php#L135-L152 |
207,228 | symfony/symfony | src/Symfony/Component/Ldap/Adapter/ExtLdap/Query.php | Query.getResource | public function getResource($idx = 0)
{
if (null === $this->results || $idx >= \count($this->results)) {
return null;
}
return $this->results[$idx];
} | php | public function getResource($idx = 0)
{
if (null === $this->results || $idx >= \count($this->results)) {
return null;
}
return $this->results[$idx];
} | [
"public",
"function",
"getResource",
"(",
"$",
"idx",
"=",
"0",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"this",
"->",
"results",
"||",
"$",
"idx",
">=",
"\\",
"count",
"(",
"$",
"this",
"->",
"results",
")",
")",
"{",
"return",
"null",
";",
"}",... | Returns a LDAP search resource. If this query resulted in multiple searches, only the first
page will be returned.
@return resource
@internal | [
"Returns",
"a",
"LDAP",
"search",
"resource",
".",
"If",
"this",
"query",
"resulted",
"in",
"multiple",
"searches",
"only",
"the",
"first",
"page",
"will",
"be",
"returned",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Ldap/Adapter/ExtLdap/Query.php#L156-L163 |
207,229 | symfony/symfony | src/Symfony/Component/Ldap/Adapter/ExtLdap/Query.php | Query.resetPagination | private function resetPagination()
{
$con = $this->connection->getResource();
ldap_control_paged_result($con, 0);
// This is a workaround for a bit of a bug in the above invocation
// of ldap_control_paged_result. Instead of indicating to extldap that
// we no longer wish to... | php | private function resetPagination()
{
$con = $this->connection->getResource();
ldap_control_paged_result($con, 0);
// This is a workaround for a bit of a bug in the above invocation
// of ldap_control_paged_result. Instead of indicating to extldap that
// we no longer wish to... | [
"private",
"function",
"resetPagination",
"(",
")",
"{",
"$",
"con",
"=",
"$",
"this",
"->",
"connection",
"->",
"getResource",
"(",
")",
";",
"ldap_control_paged_result",
"(",
"$",
"con",
",",
"0",
")",
";",
"// This is a workaround for a bit of a bug in the abov... | Resets pagination on the current connection. | [
"Resets",
"pagination",
"on",
"the",
"current",
"connection",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Ldap/Adapter/ExtLdap/Query.php#L180-L205 |
207,230 | symfony/symfony | src/Symfony/Bundle/WebProfilerBundle/Controller/ProfilerController.php | ProfilerController.panelAction | public function panelAction(Request $request, $token)
{
$this->denyAccessIfProfilerDisabled();
if (null !== $this->cspHandler) {
$this->cspHandler->disableCsp();
}
$panel = $request->query->get('panel', 'request');
$page = $request->query->get('page', 'home');
... | php | public function panelAction(Request $request, $token)
{
$this->denyAccessIfProfilerDisabled();
if (null !== $this->cspHandler) {
$this->cspHandler->disableCsp();
}
$panel = $request->query->get('panel', 'request');
$page = $request->query->get('page', 'home');
... | [
"public",
"function",
"panelAction",
"(",
"Request",
"$",
"request",
",",
"$",
"token",
")",
"{",
"$",
"this",
"->",
"denyAccessIfProfilerDisabled",
"(",
")",
";",
"if",
"(",
"null",
"!==",
"$",
"this",
"->",
"cspHandler",
")",
"{",
"$",
"this",
"->",
... | Renders a profiler panel for the given token.
@param Request $request The current HTTP request
@param string $token The profiler token
@return Response A Response instance
@throws NotFoundHttpException | [
"Renders",
"a",
"profiler",
"panel",
"for",
"the",
"given",
"token",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Bundle/WebProfilerBundle/Controller/ProfilerController.php#L72-L106 |
207,231 | symfony/symfony | src/Symfony/Bundle/WebProfilerBundle/Controller/ProfilerController.php | ProfilerController.toolbarAction | public function toolbarAction(Request $request, $token)
{
if (null === $this->profiler) {
throw new NotFoundHttpException('The profiler must be enabled.');
}
if ($request->hasSession() && ($session = $request->getSession()) && $session->isStarted() && $session->getFlashBag() ins... | php | public function toolbarAction(Request $request, $token)
{
if (null === $this->profiler) {
throw new NotFoundHttpException('The profiler must be enabled.');
}
if ($request->hasSession() && ($session = $request->getSession()) && $session->isStarted() && $session->getFlashBag() ins... | [
"public",
"function",
"toolbarAction",
"(",
"Request",
"$",
"request",
",",
"$",
"token",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"this",
"->",
"profiler",
")",
"{",
"throw",
"new",
"NotFoundHttpException",
"(",
"'The profiler must be enabled.'",
")",
";",
... | Renders the Web Debug Toolbar.
@param Request $request The current HTTP Request
@param string $token The profiler token
@return Response A Response instance
@throws NotFoundHttpException | [
"Renders",
"the",
"Web",
"Debug",
"Toolbar",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Bundle/WebProfilerBundle/Controller/ProfilerController.php#L118-L154 |
207,232 | symfony/symfony | src/Symfony/Bundle/WebProfilerBundle/Controller/ProfilerController.php | ProfilerController.searchBarAction | public function searchBarAction(Request $request)
{
$this->denyAccessIfProfilerDisabled();
if (null !== $this->cspHandler) {
$this->cspHandler->disableCsp();
}
if (!$request->hasSession()) {
$ip =
$method =
$statusCode =
$... | php | public function searchBarAction(Request $request)
{
$this->denyAccessIfProfilerDisabled();
if (null !== $this->cspHandler) {
$this->cspHandler->disableCsp();
}
if (!$request->hasSession()) {
$ip =
$method =
$statusCode =
$... | [
"public",
"function",
"searchBarAction",
"(",
"Request",
"$",
"request",
")",
"{",
"$",
"this",
"->",
"denyAccessIfProfilerDisabled",
"(",
")",
";",
"if",
"(",
"null",
"!==",
"$",
"this",
"->",
"cspHandler",
")",
"{",
"$",
"this",
"->",
"cspHandler",
"->",... | Renders the profiler search bar.
@return Response A Response instance
@throws NotFoundHttpException | [
"Renders",
"the",
"profiler",
"search",
"bar",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Bundle/WebProfilerBundle/Controller/ProfilerController.php#L163-L208 |
207,233 | symfony/symfony | src/Symfony/Bundle/WebProfilerBundle/Controller/ProfilerController.php | ProfilerController.searchResultsAction | public function searchResultsAction(Request $request, $token)
{
$this->denyAccessIfProfilerDisabled();
if (null !== $this->cspHandler) {
$this->cspHandler->disableCsp();
}
$profile = $this->profiler->loadProfile($token);
$ip = $request->query->get('ip');
... | php | public function searchResultsAction(Request $request, $token)
{
$this->denyAccessIfProfilerDisabled();
if (null !== $this->cspHandler) {
$this->cspHandler->disableCsp();
}
$profile = $this->profiler->loadProfile($token);
$ip = $request->query->get('ip');
... | [
"public",
"function",
"searchResultsAction",
"(",
"Request",
"$",
"request",
",",
"$",
"token",
")",
"{",
"$",
"this",
"->",
"denyAccessIfProfilerDisabled",
"(",
")",
";",
"if",
"(",
"null",
"!==",
"$",
"this",
"->",
"cspHandler",
")",
"{",
"$",
"this",
... | Renders the search results.
@param Request $request The current HTTP Request
@param string $token The token
@return Response A Response instance
@throws NotFoundHttpException | [
"Renders",
"the",
"search",
"results",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Bundle/WebProfilerBundle/Controller/ProfilerController.php#L220-L252 |
207,234 | symfony/symfony | src/Symfony/Bundle/WebProfilerBundle/Controller/ProfilerController.php | ProfilerController.searchAction | public function searchAction(Request $request)
{
$this->denyAccessIfProfilerDisabled();
$ip = preg_replace('/[^:\d\.]/', '', $request->query->get('ip'));
$method = $request->query->get('method');
$statusCode = $request->query->get('status_code');
$url = $request->query->get(... | php | public function searchAction(Request $request)
{
$this->denyAccessIfProfilerDisabled();
$ip = preg_replace('/[^:\d\.]/', '', $request->query->get('ip'));
$method = $request->query->get('method');
$statusCode = $request->query->get('status_code');
$url = $request->query->get(... | [
"public",
"function",
"searchAction",
"(",
"Request",
"$",
"request",
")",
"{",
"$",
"this",
"->",
"denyAccessIfProfilerDisabled",
"(",
")",
";",
"$",
"ip",
"=",
"preg_replace",
"(",
"'/[^:\\d\\.]/'",
",",
"''",
",",
"$",
"request",
"->",
"query",
"->",
"g... | Narrows the search bar.
@return Response A Response instance
@throws NotFoundHttpException | [
"Narrows",
"the",
"search",
"bar",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Bundle/WebProfilerBundle/Controller/ProfilerController.php#L261-L303 |
207,235 | symfony/symfony | src/Symfony/Bundle/WebProfilerBundle/Controller/ProfilerController.php | ProfilerController.phpinfoAction | public function phpinfoAction()
{
$this->denyAccessIfProfilerDisabled();
if (null !== $this->cspHandler) {
$this->cspHandler->disableCsp();
}
ob_start();
phpinfo();
$phpinfo = ob_get_clean();
return new Response($phpinfo, 200, ['Content-Type' =>... | php | public function phpinfoAction()
{
$this->denyAccessIfProfilerDisabled();
if (null !== $this->cspHandler) {
$this->cspHandler->disableCsp();
}
ob_start();
phpinfo();
$phpinfo = ob_get_clean();
return new Response($phpinfo, 200, ['Content-Type' =>... | [
"public",
"function",
"phpinfoAction",
"(",
")",
"{",
"$",
"this",
"->",
"denyAccessIfProfilerDisabled",
"(",
")",
";",
"if",
"(",
"null",
"!==",
"$",
"this",
"->",
"cspHandler",
")",
"{",
"$",
"this",
"->",
"cspHandler",
"->",
"disableCsp",
"(",
")",
";... | Displays the PHP info.
@return Response A Response instance
@throws NotFoundHttpException | [
"Displays",
"the",
"PHP",
"info",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Bundle/WebProfilerBundle/Controller/ProfilerController.php#L312-L325 |
207,236 | symfony/symfony | src/Symfony/Bundle/WebProfilerBundle/Controller/ProfilerController.php | ProfilerController.openAction | public function openAction(Request $request)
{
if (null === $this->baseDir) {
throw new NotFoundHttpException('The base dir should be set.');
}
if ($this->profiler) {
$this->profiler->disable();
}
$file = $request->query->get('file');
$line =... | php | public function openAction(Request $request)
{
if (null === $this->baseDir) {
throw new NotFoundHttpException('The base dir should be set.');
}
if ($this->profiler) {
$this->profiler->disable();
}
$file = $request->query->get('file');
$line =... | [
"public",
"function",
"openAction",
"(",
"Request",
"$",
"request",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"this",
"->",
"baseDir",
")",
"{",
"throw",
"new",
"NotFoundHttpException",
"(",
"'The base dir should be set.'",
")",
";",
"}",
"if",
"(",
"$",
"t... | Displays the source of a file.
@return Response A Response instance
@throws NotFoundHttpException | [
"Displays",
"the",
"source",
"of",
"a",
"file",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Bundle/WebProfilerBundle/Controller/ProfilerController.php#L334-L358 |
207,237 | symfony/symfony | src/Symfony/Bundle/WebProfilerBundle/Controller/ProfilerController.php | ProfilerController.getTemplateManager | protected function getTemplateManager()
{
if (null === $this->templateManager) {
$this->templateManager = new TemplateManager($this->profiler, $this->twig, $this->templates);
}
return $this->templateManager;
} | php | protected function getTemplateManager()
{
if (null === $this->templateManager) {
$this->templateManager = new TemplateManager($this->profiler, $this->twig, $this->templates);
}
return $this->templateManager;
} | [
"protected",
"function",
"getTemplateManager",
"(",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"this",
"->",
"templateManager",
")",
"{",
"$",
"this",
"->",
"templateManager",
"=",
"new",
"TemplateManager",
"(",
"$",
"this",
"->",
"profiler",
",",
"$",
"this... | Gets the Template Manager.
@return TemplateManager The Template Manager | [
"Gets",
"the",
"Template",
"Manager",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Bundle/WebProfilerBundle/Controller/ProfilerController.php#L365-L372 |
207,238 | symfony/symfony | src/Symfony/Component/Security/Guard/GuardAuthenticatorHandler.php | GuardAuthenticatorHandler.authenticateWithToken | public function authenticateWithToken(TokenInterface $token, Request $request, string $providerKey = null)
{
$this->migrateSession($request, $token, $providerKey);
$this->tokenStorage->setToken($token);
if (null !== $this->dispatcher) {
$loginEvent = new InteractiveLoginEvent($r... | php | public function authenticateWithToken(TokenInterface $token, Request $request, string $providerKey = null)
{
$this->migrateSession($request, $token, $providerKey);
$this->tokenStorage->setToken($token);
if (null !== $this->dispatcher) {
$loginEvent = new InteractiveLoginEvent($r... | [
"public",
"function",
"authenticateWithToken",
"(",
"TokenInterface",
"$",
"token",
",",
"Request",
"$",
"request",
",",
"string",
"$",
"providerKey",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"migrateSession",
"(",
"$",
"request",
",",
"$",
"token",
",",
... | Authenticates the given token in the system.
@param string $providerKey The name of the provider/firewall being used for authentication | [
"Authenticates",
"the",
"given",
"token",
"in",
"the",
"system",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Security/Guard/GuardAuthenticatorHandler.php#L58-L67 |
207,239 | symfony/symfony | src/Symfony/Component/HttpFoundation/Session/Attribute/NamespacedAttributeBag.php | NamespacedAttributeBag.& | protected function &resolveAttributePath($name, $writeContext = false)
{
$array = &$this->attributes;
$name = (0 === strpos($name, $this->namespaceCharacter)) ? substr($name, 1) : $name;
// Check if there is anything to do, else return
if (!$name) {
return $array;
... | php | protected function &resolveAttributePath($name, $writeContext = false)
{
$array = &$this->attributes;
$name = (0 === strpos($name, $this->namespaceCharacter)) ? substr($name, 1) : $name;
// Check if there is anything to do, else return
if (!$name) {
return $array;
... | [
"protected",
"function",
"&",
"resolveAttributePath",
"(",
"$",
"name",
",",
"$",
"writeContext",
"=",
"false",
")",
"{",
"$",
"array",
"=",
"&",
"$",
"this",
"->",
"attributes",
";",
"$",
"name",
"=",
"(",
"0",
"===",
"strpos",
"(",
"$",
"name",
","... | Resolves a path in attributes property and returns it as a reference.
This method allows structured namespacing of session attributes.
@param string $name Key name
@param bool $writeContext Write context, default false
@return array | [
"Resolves",
"a",
"path",
"in",
"attributes",
"property",
"and",
"returns",
"it",
"as",
"a",
"reference",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/HttpFoundation/Session/Attribute/NamespacedAttributeBag.php#L102-L140 |
207,240 | symfony/symfony | src/Symfony/Component/HttpFoundation/Session/Attribute/NamespacedAttributeBag.php | NamespacedAttributeBag.resolveKey | protected function resolveKey($name)
{
if (false !== $pos = strrpos($name, $this->namespaceCharacter)) {
$name = substr($name, $pos + 1);
}
return $name;
} | php | protected function resolveKey($name)
{
if (false !== $pos = strrpos($name, $this->namespaceCharacter)) {
$name = substr($name, $pos + 1);
}
return $name;
} | [
"protected",
"function",
"resolveKey",
"(",
"$",
"name",
")",
"{",
"if",
"(",
"false",
"!==",
"$",
"pos",
"=",
"strrpos",
"(",
"$",
"name",
",",
"$",
"this",
"->",
"namespaceCharacter",
")",
")",
"{",
"$",
"name",
"=",
"substr",
"(",
"$",
"name",
"... | Resolves the key from the name.
This is the last part in a dot separated string.
@param string $name
@return string | [
"Resolves",
"the",
"key",
"from",
"the",
"name",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/HttpFoundation/Session/Attribute/NamespacedAttributeBag.php#L151-L158 |
207,241 | symfony/symfony | src/Symfony/Bundle/FrameworkBundle/Controller/AbstractController.php | AbstractController.getParameter | protected function getParameter(string $name)
{
if (!$this->container->has('parameter_bag')) {
throw new ServiceNotFoundException('parameter_bag', null, null, [], sprintf('The "%s::getParameter()" method is missing a parameter bag to work properly. Did you forget to register your controller as a... | php | protected function getParameter(string $name)
{
if (!$this->container->has('parameter_bag')) {
throw new ServiceNotFoundException('parameter_bag', null, null, [], sprintf('The "%s::getParameter()" method is missing a parameter bag to work properly. Did you forget to register your controller as a... | [
"protected",
"function",
"getParameter",
"(",
"string",
"$",
"name",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"container",
"->",
"has",
"(",
"'parameter_bag'",
")",
")",
"{",
"throw",
"new",
"ServiceNotFoundException",
"(",
"'parameter_bag'",
",",
"null"... | Gets a container parameter by its name.
@return mixed
@final | [
"Gets",
"a",
"container",
"parameter",
"by",
"its",
"name",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Bundle/FrameworkBundle/Controller/AbstractController.php#L65-L72 |
207,242 | symfony/symfony | src/Symfony/Bridge/Twig/NodeVisitor/Scope.php | Scope.has | public function has($key)
{
if (\array_key_exists($key, $this->data)) {
return true;
}
if (null === $this->parent) {
return false;
}
return $this->parent->has($key);
} | php | public function has($key)
{
if (\array_key_exists($key, $this->data)) {
return true;
}
if (null === $this->parent) {
return false;
}
return $this->parent->has($key);
} | [
"public",
"function",
"has",
"(",
"$",
"key",
")",
"{",
"if",
"(",
"\\",
"array_key_exists",
"(",
"$",
"key",
",",
"$",
"this",
"->",
"data",
")",
")",
"{",
"return",
"true",
";",
"}",
"if",
"(",
"null",
"===",
"$",
"this",
"->",
"parent",
")",
... | Tests if a data is visible from current scope.
@param string $key
@return bool | [
"Tests",
"if",
"a",
"data",
"is",
"visible",
"from",
"current",
"scope",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Bridge/Twig/NodeVisitor/Scope.php#L78-L89 |
207,243 | symfony/symfony | src/Symfony/Bridge/Twig/NodeVisitor/Scope.php | Scope.get | public function get($key, $default = null)
{
if (\array_key_exists($key, $this->data)) {
return $this->data[$key];
}
if (null === $this->parent) {
return $default;
}
return $this->parent->get($key, $default);
} | php | public function get($key, $default = null)
{
if (\array_key_exists($key, $this->data)) {
return $this->data[$key];
}
if (null === $this->parent) {
return $default;
}
return $this->parent->get($key, $default);
} | [
"public",
"function",
"get",
"(",
"$",
"key",
",",
"$",
"default",
"=",
"null",
")",
"{",
"if",
"(",
"\\",
"array_key_exists",
"(",
"$",
"key",
",",
"$",
"this",
"->",
"data",
")",
")",
"{",
"return",
"$",
"this",
"->",
"data",
"[",
"$",
"key",
... | Returns data visible from current scope.
@param string $key
@param mixed $default
@return mixed | [
"Returns",
"data",
"visible",
"from",
"current",
"scope",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Bridge/Twig/NodeVisitor/Scope.php#L99-L110 |
207,244 | symfony/symfony | src/Symfony/Component/Validator/DependencyInjection/AddAutoMappingConfigurationPass.php | AddAutoMappingConfigurationPass.getRegexp | private function getRegexp(array $patterns): string
{
$regexps = [];
foreach ($patterns as $pattern) {
// Escape namespace
$regex = preg_quote(ltrim($pattern, '\\'));
// Wildcards * and **
$regex = strtr($regex, ['\\*\\*' => '.*?', '\\*' => '[^\\\\]*?... | php | private function getRegexp(array $patterns): string
{
$regexps = [];
foreach ($patterns as $pattern) {
// Escape namespace
$regex = preg_quote(ltrim($pattern, '\\'));
// Wildcards * and **
$regex = strtr($regex, ['\\*\\*' => '.*?', '\\*' => '[^\\\\]*?... | [
"private",
"function",
"getRegexp",
"(",
"array",
"$",
"patterns",
")",
":",
"string",
"{",
"$",
"regexps",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"patterns",
"as",
"$",
"pattern",
")",
"{",
"// Escape namespace",
"$",
"regex",
"=",
"preg_quote",
"(",
... | Builds a regexp to check if a class is auto-mapped. | [
"Builds",
"a",
"regexp",
"to",
"check",
"if",
"a",
"class",
"is",
"auto",
"-",
"mapped",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Validator/DependencyInjection/AddAutoMappingConfigurationPass.php#L73-L92 |
207,245 | symfony/symfony | src/Symfony/Component/Console/Helper/DebugFormatterHelper.php | DebugFormatterHelper.start | public function start($id, $message, $prefix = 'RUN')
{
$this->started[$id] = ['border' => ++$this->count % \count($this->colors)];
return sprintf("%s<bg=blue;fg=white> %s </> <fg=blue>%s</>\n", $this->getBorder($id), $prefix, $message);
} | php | public function start($id, $message, $prefix = 'RUN')
{
$this->started[$id] = ['border' => ++$this->count % \count($this->colors)];
return sprintf("%s<bg=blue;fg=white> %s </> <fg=blue>%s</>\n", $this->getBorder($id), $prefix, $message);
} | [
"public",
"function",
"start",
"(",
"$",
"id",
",",
"$",
"message",
",",
"$",
"prefix",
"=",
"'RUN'",
")",
"{",
"$",
"this",
"->",
"started",
"[",
"$",
"id",
"]",
"=",
"[",
"'border'",
"=>",
"++",
"$",
"this",
"->",
"count",
"%",
"\\",
"count",
... | Starts a debug formatting session.
@param string $id The id of the formatting session
@param string $message The message to display
@param string $prefix The prefix to use
@return string | [
"Starts",
"a",
"debug",
"formatting",
"session",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Console/Helper/DebugFormatterHelper.php#L36-L41 |
207,246 | symfony/symfony | src/Symfony/Component/Console/Helper/DebugFormatterHelper.php | DebugFormatterHelper.progress | public function progress($id, $buffer, $error = false, $prefix = 'OUT', $errorPrefix = 'ERR')
{
$message = '';
if ($error) {
if (isset($this->started[$id]['out'])) {
$message .= "\n";
unset($this->started[$id]['out']);
}
if (!isset... | php | public function progress($id, $buffer, $error = false, $prefix = 'OUT', $errorPrefix = 'ERR')
{
$message = '';
if ($error) {
if (isset($this->started[$id]['out'])) {
$message .= "\n";
unset($this->started[$id]['out']);
}
if (!isset... | [
"public",
"function",
"progress",
"(",
"$",
"id",
",",
"$",
"buffer",
",",
"$",
"error",
"=",
"false",
",",
"$",
"prefix",
"=",
"'OUT'",
",",
"$",
"errorPrefix",
"=",
"'ERR'",
")",
"{",
"$",
"message",
"=",
"''",
";",
"if",
"(",
"$",
"error",
")"... | Adds progress to a formatting session.
@param string $id The id of the formatting session
@param string $buffer The message to display
@param bool $error Whether to consider the buffer as error
@param string $prefix The prefix for output
@param string $errorPrefix The prefix for error output... | [
"Adds",
"progress",
"to",
"a",
"formatting",
"session",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Console/Helper/DebugFormatterHelper.php#L54-L83 |
207,247 | symfony/symfony | src/Symfony/Component/Console/Helper/DebugFormatterHelper.php | DebugFormatterHelper.stop | public function stop($id, $message, $successful, $prefix = 'RES')
{
$trailingEOL = isset($this->started[$id]['out']) || isset($this->started[$id]['err']) ? "\n" : '';
if ($successful) {
return sprintf("%s%s<bg=green;fg=white> %s </> <fg=green>%s</>\n", $trailingEOL, $this->getBorder($id... | php | public function stop($id, $message, $successful, $prefix = 'RES')
{
$trailingEOL = isset($this->started[$id]['out']) || isset($this->started[$id]['err']) ? "\n" : '';
if ($successful) {
return sprintf("%s%s<bg=green;fg=white> %s </> <fg=green>%s</>\n", $trailingEOL, $this->getBorder($id... | [
"public",
"function",
"stop",
"(",
"$",
"id",
",",
"$",
"message",
",",
"$",
"successful",
",",
"$",
"prefix",
"=",
"'RES'",
")",
"{",
"$",
"trailingEOL",
"=",
"isset",
"(",
"$",
"this",
"->",
"started",
"[",
"$",
"id",
"]",
"[",
"'out'",
"]",
")... | Stops a formatting session.
@param string $id The id of the formatting session
@param string $message The message to display
@param bool $successful Whether to consider the result as success
@param string $prefix The prefix for the end output
@return string | [
"Stops",
"a",
"formatting",
"session",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Console/Helper/DebugFormatterHelper.php#L95-L108 |
207,248 | symfony/symfony | src/Symfony/Component/Serializer/Encoder/XmlEncoder.php | XmlEncoder.setRootNodeName | public function setRootNodeName($name)
{
@trigger_error(sprintf('The "%s()" method is deprecated since Symfony 4.2, use the context instead.', __METHOD__), E_USER_DEPRECATED);
$this->defaultContext[self::ROOT_NODE_NAME] = $name;
} | php | public function setRootNodeName($name)
{
@trigger_error(sprintf('The "%s()" method is deprecated since Symfony 4.2, use the context instead.', __METHOD__), E_USER_DEPRECATED);
$this->defaultContext[self::ROOT_NODE_NAME] = $name;
} | [
"public",
"function",
"setRootNodeName",
"(",
"$",
"name",
")",
"{",
"@",
"trigger_error",
"(",
"sprintf",
"(",
"'The \"%s()\" method is deprecated since Symfony 4.2, use the context instead.'",
",",
"__METHOD__",
")",
",",
"E_USER_DEPRECATED",
")",
";",
"$",
"this",
"-... | Sets the root node name.
@deprecated since Symfony 4.2
@param string $name Root node name | [
"Sets",
"the",
"root",
"node",
"name",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Serializer/Encoder/XmlEncoder.php#L213-L218 |
207,249 | symfony/symfony | src/Symfony/Component/Serializer/Encoder/XmlEncoder.php | XmlEncoder.isElementNameValid | final protected function isElementNameValid(string $name): bool
{
return $name &&
false === strpos($name, ' ') &&
preg_match('#^[\pL_][\pL0-9._:-]*$#ui', $name);
} | php | final protected function isElementNameValid(string $name): bool
{
return $name &&
false === strpos($name, ' ') &&
preg_match('#^[\pL_][\pL0-9._:-]*$#ui', $name);
} | [
"final",
"protected",
"function",
"isElementNameValid",
"(",
"string",
"$",
"name",
")",
":",
"bool",
"{",
"return",
"$",
"name",
"&&",
"false",
"===",
"strpos",
"(",
"$",
"name",
",",
"' '",
")",
"&&",
"preg_match",
"(",
"'#^[\\pL_][\\pL0-9._:-]*$#ui'",
","... | Checks the name is a valid xml element name. | [
"Checks",
"the",
"name",
"is",
"a",
"valid",
"xml",
"element",
"name",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Serializer/Encoder/XmlEncoder.php#L288-L293 |
207,250 | symfony/symfony | src/Symfony/Component/Serializer/Encoder/XmlEncoder.php | XmlEncoder.parseXml | private function parseXml(\DOMNode $node, array $context = [])
{
$data = $this->parseXmlAttributes($node, $context);
$value = $this->parseXmlValue($node, $context);
if (!\count($data)) {
return $value;
}
if (!\is_array($value)) {
$data['#'] = $value... | php | private function parseXml(\DOMNode $node, array $context = [])
{
$data = $this->parseXmlAttributes($node, $context);
$value = $this->parseXmlValue($node, $context);
if (!\count($data)) {
return $value;
}
if (!\is_array($value)) {
$data['#'] = $value... | [
"private",
"function",
"parseXml",
"(",
"\\",
"DOMNode",
"$",
"node",
",",
"array",
"$",
"context",
"=",
"[",
"]",
")",
"{",
"$",
"data",
"=",
"$",
"this",
"->",
"parseXmlAttributes",
"(",
"$",
"node",
",",
"$",
"context",
")",
";",
"$",
"value",
"... | Parse the input DOMNode into an array or a string.
@return array|string | [
"Parse",
"the",
"input",
"DOMNode",
"into",
"an",
"array",
"or",
"a",
"string",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Serializer/Encoder/XmlEncoder.php#L300-L327 |
207,251 | symfony/symfony | src/Symfony/Component/Serializer/Encoder/XmlEncoder.php | XmlEncoder.parseXmlAttributes | private function parseXmlAttributes(\DOMNode $node, array $context = []): array
{
if (!$node->hasAttributes()) {
return [];
}
$data = [];
$typeCastAttributes = (bool) ($context[self::TYPE_CASE_ATTRIBUTES] ?? $this->defaultContext[self::TYPE_CASE_ATTRIBUTES]);
fo... | php | private function parseXmlAttributes(\DOMNode $node, array $context = []): array
{
if (!$node->hasAttributes()) {
return [];
}
$data = [];
$typeCastAttributes = (bool) ($context[self::TYPE_CASE_ATTRIBUTES] ?? $this->defaultContext[self::TYPE_CASE_ATTRIBUTES]);
fo... | [
"private",
"function",
"parseXmlAttributes",
"(",
"\\",
"DOMNode",
"$",
"node",
",",
"array",
"$",
"context",
"=",
"[",
"]",
")",
":",
"array",
"{",
"if",
"(",
"!",
"$",
"node",
"->",
"hasAttributes",
"(",
")",
")",
"{",
"return",
"[",
"]",
";",
"}... | Parse the input DOMNode attributes into an array. | [
"Parse",
"the",
"input",
"DOMNode",
"attributes",
"into",
"an",
"array",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Serializer/Encoder/XmlEncoder.php#L332-L358 |
207,252 | symfony/symfony | src/Symfony/Component/Serializer/Encoder/XmlEncoder.php | XmlEncoder.appendNode | private function appendNode(\DOMNode $parentNode, $data, string $nodeName, string $key = null): bool
{
$node = $this->dom->createElement($nodeName);
if (null !== $key) {
$node->setAttribute('key', $key);
}
$appendNode = $this->selectNodeType($node, $data);
// we m... | php | private function appendNode(\DOMNode $parentNode, $data, string $nodeName, string $key = null): bool
{
$node = $this->dom->createElement($nodeName);
if (null !== $key) {
$node->setAttribute('key', $key);
}
$appendNode = $this->selectNodeType($node, $data);
// we m... | [
"private",
"function",
"appendNode",
"(",
"\\",
"DOMNode",
"$",
"parentNode",
",",
"$",
"data",
",",
"string",
"$",
"nodeName",
",",
"string",
"$",
"key",
"=",
"null",
")",
":",
"bool",
"{",
"$",
"node",
"=",
"$",
"this",
"->",
"dom",
"->",
"createEl... | Selects the type of node to create and appends it to the parent.
@param array|object $data | [
"Selects",
"the",
"type",
"of",
"node",
"to",
"create",
"and",
"appends",
"it",
"to",
"the",
"parent",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Serializer/Encoder/XmlEncoder.php#L477-L490 |
207,253 | symfony/symfony | src/Symfony/Component/Serializer/Encoder/XmlEncoder.php | XmlEncoder.selectNodeType | private function selectNodeType(\DOMNode $node, $val): bool
{
if (\is_array($val)) {
return $this->buildXml($node, $val);
} elseif ($val instanceof \SimpleXMLElement) {
$child = $this->dom->importNode(dom_import_simplexml($val), true);
$node->appendChild($child);
... | php | private function selectNodeType(\DOMNode $node, $val): bool
{
if (\is_array($val)) {
return $this->buildXml($node, $val);
} elseif ($val instanceof \SimpleXMLElement) {
$child = $this->dom->importNode(dom_import_simplexml($val), true);
$node->appendChild($child);
... | [
"private",
"function",
"selectNodeType",
"(",
"\\",
"DOMNode",
"$",
"node",
",",
"$",
"val",
")",
":",
"bool",
"{",
"if",
"(",
"\\",
"is_array",
"(",
"$",
"val",
")",
")",
"{",
"return",
"$",
"this",
"->",
"buildXml",
"(",
"$",
"node",
",",
"$",
... | Tests the value being passed and decide what sort of element to create.
@param mixed $val
@throws NotEncodableValueException | [
"Tests",
"the",
"value",
"being",
"passed",
"and",
"decide",
"what",
"sort",
"of",
"element",
"to",
"create",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Serializer/Encoder/XmlEncoder.php#L507-L532 |
207,254 | symfony/symfony | src/Symfony/Component/Serializer/Encoder/XmlEncoder.php | XmlEncoder.createDomDocument | private function createDomDocument(array $context): \DOMDocument
{
$document = new \DOMDocument();
// Set an attribute on the DOM document specifying, as part of the XML declaration,
$xmlOptions = [
// nicely formats output with indentation and extra space
self::FORM... | php | private function createDomDocument(array $context): \DOMDocument
{
$document = new \DOMDocument();
// Set an attribute on the DOM document specifying, as part of the XML declaration,
$xmlOptions = [
// nicely formats output with indentation and extra space
self::FORM... | [
"private",
"function",
"createDomDocument",
"(",
"array",
"$",
"context",
")",
":",
"\\",
"DOMDocument",
"{",
"$",
"document",
"=",
"new",
"\\",
"DOMDocument",
"(",
")",
";",
"// Set an attribute on the DOM document specifying, as part of the XML declaration,",
"$",
"xm... | Create a DOM document, taking serializer options into account. | [
"Create",
"a",
"DOM",
"document",
"taking",
"serializer",
"options",
"into",
"account",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Serializer/Encoder/XmlEncoder.php#L537-L559 |
207,255 | symfony/symfony | src/Symfony/Component/Yaml/Escaper.php | Escaper.escapeWithDoubleQuotes | public static function escapeWithDoubleQuotes(string $value): string
{
return sprintf('"%s"', str_replace(self::$escapees, self::$escaped, $value));
} | php | public static function escapeWithDoubleQuotes(string $value): string
{
return sprintf('"%s"', str_replace(self::$escapees, self::$escaped, $value));
} | [
"public",
"static",
"function",
"escapeWithDoubleQuotes",
"(",
"string",
"$",
"value",
")",
":",
"string",
"{",
"return",
"sprintf",
"(",
"'\"%s\"'",
",",
"str_replace",
"(",
"self",
"::",
"$",
"escapees",
",",
"self",
"::",
"$",
"escaped",
",",
"$",
"valu... | Escapes and surrounds a PHP value with double quotes.
@param string $value A PHP value
@return string The quoted, escaped string | [
"Escapes",
"and",
"surrounds",
"a",
"PHP",
"value",
"with",
"double",
"quotes",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Yaml/Escaper.php#L65-L68 |
207,256 | symfony/symfony | src/Symfony/Component/Intl/DateFormatter/DateFormat/FullTransformer.php | FullTransformer.format | public function format(\DateTime $dateTime)
{
$formatted = preg_replace_callback($this->regExp, function ($matches) use ($dateTime) {
return $this->formatReplace($matches[0], $dateTime);
}, $this->pattern);
return $formatted;
} | php | public function format(\DateTime $dateTime)
{
$formatted = preg_replace_callback($this->regExp, function ($matches) use ($dateTime) {
return $this->formatReplace($matches[0], $dateTime);
}, $this->pattern);
return $formatted;
} | [
"public",
"function",
"format",
"(",
"\\",
"DateTime",
"$",
"dateTime",
")",
"{",
"$",
"formatted",
"=",
"preg_replace_callback",
"(",
"$",
"this",
"->",
"regExp",
",",
"function",
"(",
"$",
"matches",
")",
"use",
"(",
"$",
"dateTime",
")",
"{",
"return"... | Format a DateTime using ICU dateformat pattern.
@param \DateTime $dateTime A DateTime object to be used to generate the formatted value
@return string The formatted value | [
"Format",
"a",
"DateTime",
"using",
"ICU",
"dateformat",
"pattern",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Intl/DateFormatter/DateFormat/FullTransformer.php#L89-L96 |
207,257 | symfony/symfony | src/Symfony/Component/Intl/DateFormatter/DateFormat/FullTransformer.php | FullTransformer.parse | public function parse(\DateTime $dateTime, $value)
{
$reverseMatchingRegExp = $this->getReverseMatchingRegExp($this->pattern);
$reverseMatchingRegExp = '/^'.$reverseMatchingRegExp.'$/';
$options = [];
if (preg_match($reverseMatchingRegExp, $value, $matches)) {
$matches ... | php | public function parse(\DateTime $dateTime, $value)
{
$reverseMatchingRegExp = $this->getReverseMatchingRegExp($this->pattern);
$reverseMatchingRegExp = '/^'.$reverseMatchingRegExp.'$/';
$options = [];
if (preg_match($reverseMatchingRegExp, $value, $matches)) {
$matches ... | [
"public",
"function",
"parse",
"(",
"\\",
"DateTime",
"$",
"dateTime",
",",
"$",
"value",
")",
"{",
"$",
"reverseMatchingRegExp",
"=",
"$",
"this",
"->",
"getReverseMatchingRegExp",
"(",
"$",
"this",
"->",
"pattern",
")",
";",
"$",
"reverseMatchingRegExp",
"... | Parse a pattern based string to a timestamp value.
@param \DateTime $dateTime A configured DateTime object to use to perform the date calculation
@param string $value String to convert to a time value
@return int|false The corresponding Unix timestamp
@throws \InvalidArgumentException When the value can not be... | [
"Parse",
"a",
"pattern",
"based",
"string",
"to",
"a",
"timestamp",
"value",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Intl/DateFormatter/DateFormat/FullTransformer.php#L138-L165 |
207,258 | symfony/symfony | src/Symfony/Component/Intl/DateFormatter/DateFormat/FullTransformer.php | FullTransformer.getReverseMatchingRegExp | public function getReverseMatchingRegExp($pattern)
{
$escapedPattern = preg_quote($pattern, '/');
// ICU 4.8 recognizes slash ("/") in a value to be parsed as a dash ("-") and vice-versa
// when parsing a date/time value
$escapedPattern = preg_replace('/\\\[\-|\/]/', '[\/\-]', $esca... | php | public function getReverseMatchingRegExp($pattern)
{
$escapedPattern = preg_quote($pattern, '/');
// ICU 4.8 recognizes slash ("/") in a value to be parsed as a dash ("-") and vice-versa
// when parsing a date/time value
$escapedPattern = preg_replace('/\\\[\-|\/]/', '[\/\-]', $esca... | [
"public",
"function",
"getReverseMatchingRegExp",
"(",
"$",
"pattern",
")",
"{",
"$",
"escapedPattern",
"=",
"preg_quote",
"(",
"$",
"pattern",
",",
"'/'",
")",
";",
"// ICU 4.8 recognizes slash (\"/\") in a value to be parsed as a dash (\"-\") and vice-versa",
"// when parsi... | Retrieve a regular expression to match with a formatted value.
@param string $pattern The pattern to create the reverse matching regular expression
@return string The reverse matching regular expression with named captures being formed by the
transformer index in the $transformer array | [
"Retrieve",
"a",
"regular",
"expression",
"to",
"match",
"with",
"a",
"formatted",
"value",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Intl/DateFormatter/DateFormat/FullTransformer.php#L175-L202 |
207,259 | symfony/symfony | src/Symfony/Component/Intl/DateFormatter/DateFormat/FullTransformer.php | FullTransformer.buildCharsMatch | protected function buildCharsMatch($specialChars)
{
$specialCharsArray = str_split($specialChars);
$specialCharsMatch = implode('|', array_map(function ($char) {
return $char.'+';
}, $specialCharsArray));
return $specialCharsMatch;
} | php | protected function buildCharsMatch($specialChars)
{
$specialCharsArray = str_split($specialChars);
$specialCharsMatch = implode('|', array_map(function ($char) {
return $char.'+';
}, $specialCharsArray));
return $specialCharsMatch;
} | [
"protected",
"function",
"buildCharsMatch",
"(",
"$",
"specialChars",
")",
"{",
"$",
"specialCharsArray",
"=",
"str_split",
"(",
"$",
"specialChars",
")",
";",
"$",
"specialCharsMatch",
"=",
"implode",
"(",
"'|'",
",",
"array_map",
"(",
"function",
"(",
"$",
... | Builds a chars match regular expression.
@param string $specialChars A string of chars to build the regular expression
@return string The chars match regular expression | [
"Builds",
"a",
"chars",
"match",
"regular",
"expression",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Intl/DateFormatter/DateFormat/FullTransformer.php#L239-L248 |
207,260 | symfony/symfony | src/Symfony/Component/Intl/DateFormatter/DateFormat/FullTransformer.php | FullTransformer.normalizeArray | protected function normalizeArray(array $data)
{
$ret = [];
foreach ($data as $key => $value) {
if (!\is_string($key)) {
continue;
}
$ret[$key[0]] = [
'value' => $value,
'pattern' => $key,
];
}
... | php | protected function normalizeArray(array $data)
{
$ret = [];
foreach ($data as $key => $value) {
if (!\is_string($key)) {
continue;
}
$ret[$key[0]] = [
'value' => $value,
'pattern' => $key,
];
}
... | [
"protected",
"function",
"normalizeArray",
"(",
"array",
"$",
"data",
")",
"{",
"$",
"ret",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"data",
"as",
"$",
"key",
"=>",
"$",
"value",
")",
"{",
"if",
"(",
"!",
"\\",
"is_string",
"(",
"$",
"key",
")",
... | Normalize a preg_replace match array, removing the numeric keys and returning an associative array
with the value and pattern values for the matched Transformer.
@return array | [
"Normalize",
"a",
"preg_replace",
"match",
"array",
"removing",
"the",
"numeric",
"keys",
"and",
"returning",
"an",
"associative",
"array",
"with",
"the",
"value",
"and",
"pattern",
"values",
"for",
"the",
"matched",
"Transformer",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Intl/DateFormatter/DateFormat/FullTransformer.php#L256-L272 |
207,261 | symfony/symfony | src/Symfony/Component/Serializer/Encoder/ChainEncoder.php | ChainEncoder.needsNormalization | public function needsNormalization($format, array $context = [])
{
$encoder = $this->getEncoder($format, $context);
if (!$encoder instanceof NormalizationAwareInterface) {
return true;
}
if ($encoder instanceof self) {
return $encoder->needsNormalization($fo... | php | public function needsNormalization($format, array $context = [])
{
$encoder = $this->getEncoder($format, $context);
if (!$encoder instanceof NormalizationAwareInterface) {
return true;
}
if ($encoder instanceof self) {
return $encoder->needsNormalization($fo... | [
"public",
"function",
"needsNormalization",
"(",
"$",
"format",
",",
"array",
"$",
"context",
"=",
"[",
"]",
")",
"{",
"$",
"encoder",
"=",
"$",
"this",
"->",
"getEncoder",
"(",
"$",
"format",
",",
"$",
"context",
")",
";",
"if",
"(",
"!",
"$",
"en... | Checks whether the normalization is needed for the given format.
@param string $format
@param array $context
@return bool | [
"Checks",
"whether",
"the",
"normalization",
"is",
"needed",
"for",
"the",
"given",
"format",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Serializer/Encoder/ChainEncoder.php#L65-L78 |
207,262 | symfony/symfony | src/Symfony/Component/Serializer/Encoder/ChainEncoder.php | ChainEncoder.getEncoder | private function getEncoder(string $format, array $context): EncoderInterface
{
if (isset($this->encoderByFormat[$format])
&& isset($this->encoders[$this->encoderByFormat[$format]])
) {
return $this->encoders[$this->encoderByFormat[$format]];
}
foreach ($this... | php | private function getEncoder(string $format, array $context): EncoderInterface
{
if (isset($this->encoderByFormat[$format])
&& isset($this->encoders[$this->encoderByFormat[$format]])
) {
return $this->encoders[$this->encoderByFormat[$format]];
}
foreach ($this... | [
"private",
"function",
"getEncoder",
"(",
"string",
"$",
"format",
",",
"array",
"$",
"context",
")",
":",
"EncoderInterface",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"encoderByFormat",
"[",
"$",
"format",
"]",
")",
"&&",
"isset",
"(",
"$",
"t... | Gets the encoder supporting the format.
@throws RuntimeException if no encoder is found | [
"Gets",
"the",
"encoder",
"supporting",
"the",
"format",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Serializer/Encoder/ChainEncoder.php#L85-L102 |
207,263 | symfony/symfony | src/Symfony/Component/Form/FormErrorIterator.php | FormErrorIterator.offsetGet | public function offsetGet($position)
{
if (!isset($this->errors[$position])) {
throw new OutOfBoundsException('The offset '.$position.' does not exist.');
}
return $this->errors[$position];
} | php | public function offsetGet($position)
{
if (!isset($this->errors[$position])) {
throw new OutOfBoundsException('The offset '.$position.' does not exist.');
}
return $this->errors[$position];
} | [
"public",
"function",
"offsetGet",
"(",
"$",
"position",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"errors",
"[",
"$",
"position",
"]",
")",
")",
"{",
"throw",
"new",
"OutOfBoundsException",
"(",
"'The offset '",
".",
"$",
"position",
... | Returns the element at a position in the iterator.
@param int $position The position
@return FormError|FormErrorIterator The element at the given position
@throws OutOfBoundsException If the given position does not exist | [
"Returns",
"the",
"element",
"at",
"a",
"position",
"in",
"the",
"iterator",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Form/FormErrorIterator.php#L162-L169 |
207,264 | symfony/symfony | src/Symfony/Component/Form/FormErrorIterator.php | FormErrorIterator.seek | public function seek($position)
{
if (!isset($this->errors[$position])) {
throw new OutOfBoundsException('The offset '.$position.' does not exist.');
}
reset($this->errors);
while ($position !== key($this->errors)) {
next($this->errors);
}
} | php | public function seek($position)
{
if (!isset($this->errors[$position])) {
throw new OutOfBoundsException('The offset '.$position.' does not exist.');
}
reset($this->errors);
while ($position !== key($this->errors)) {
next($this->errors);
}
} | [
"public",
"function",
"seek",
"(",
"$",
"position",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"errors",
"[",
"$",
"position",
"]",
")",
")",
"{",
"throw",
"new",
"OutOfBoundsException",
"(",
"'The offset '",
".",
"$",
"position",
".",
... | Sets the position of the iterator.
@param int $position The new position
@throws OutOfBoundsException If the position is invalid | [
"Sets",
"the",
"position",
"of",
"the",
"iterator",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Form/FormErrorIterator.php#L239-L250 |
207,265 | symfony/symfony | src/Symfony/Component/Config/Definition/Processor.php | Processor.process | public function process(NodeInterface $configTree, array $configs)
{
$currentConfig = [];
foreach ($configs as $config) {
$config = $configTree->normalize($config);
$currentConfig = $configTree->merge($currentConfig, $config);
}
return $configTree->finalize($... | php | public function process(NodeInterface $configTree, array $configs)
{
$currentConfig = [];
foreach ($configs as $config) {
$config = $configTree->normalize($config);
$currentConfig = $configTree->merge($currentConfig, $config);
}
return $configTree->finalize($... | [
"public",
"function",
"process",
"(",
"NodeInterface",
"$",
"configTree",
",",
"array",
"$",
"configs",
")",
"{",
"$",
"currentConfig",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"configs",
"as",
"$",
"config",
")",
"{",
"$",
"config",
"=",
"$",
"configT... | Processes an array of configurations.
@param NodeInterface $configTree The node tree describing the configuration
@param array $configs An array of configuration items to process
@return array The processed configuration | [
"Processes",
"an",
"array",
"of",
"configurations",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Config/Definition/Processor.php#L31-L40 |
207,266 | symfony/symfony | src/Symfony/Bundle/WebProfilerBundle/Csp/ContentSecurityPolicyHandler.php | ContentSecurityPolicyHandler.getNonces | public function getNonces(Request $request, Response $response)
{
if ($request->headers->has('X-SymfonyProfiler-Script-Nonce') && $request->headers->has('X-SymfonyProfiler-Style-Nonce')) {
return [
'csp_script_nonce' => $request->headers->get('X-SymfonyProfiler-Script-Nonce'),
... | php | public function getNonces(Request $request, Response $response)
{
if ($request->headers->has('X-SymfonyProfiler-Script-Nonce') && $request->headers->has('X-SymfonyProfiler-Style-Nonce')) {
return [
'csp_script_nonce' => $request->headers->get('X-SymfonyProfiler-Script-Nonce'),
... | [
"public",
"function",
"getNonces",
"(",
"Request",
"$",
"request",
",",
"Response",
"$",
"response",
")",
"{",
"if",
"(",
"$",
"request",
"->",
"headers",
"->",
"has",
"(",
"'X-SymfonyProfiler-Script-Nonce'",
")",
"&&",
"$",
"request",
"->",
"headers",
"->",... | Returns an array of nonces to be used in Twig templates and Content-Security-Policy headers.
Nonce can be provided by;
- The request - In case HTML content is fetched via AJAX and inserted in DOM, it must use the same nonce as origin
- The response - A call to getNonces() has already been done previously. Same nonce ... | [
"Returns",
"an",
"array",
"of",
"nonces",
"to",
"be",
"used",
"in",
"Twig",
"templates",
"and",
"Content",
"-",
"Security",
"-",
"Policy",
"headers",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Bundle/WebProfilerBundle/Csp/ContentSecurityPolicyHandler.php#L44-L69 |
207,267 | symfony/symfony | src/Symfony/Bundle/WebProfilerBundle/Csp/ContentSecurityPolicyHandler.php | ContentSecurityPolicyHandler.updateResponseHeaders | public function updateResponseHeaders(Request $request, Response $response)
{
if ($this->cspDisabled) {
$this->removeCspHeaders($response);
return [];
}
$nonces = $this->getNonces($request, $response);
$this->cleanHeaders($response);
$this->updateCsp... | php | public function updateResponseHeaders(Request $request, Response $response)
{
if ($this->cspDisabled) {
$this->removeCspHeaders($response);
return [];
}
$nonces = $this->getNonces($request, $response);
$this->cleanHeaders($response);
$this->updateCsp... | [
"public",
"function",
"updateResponseHeaders",
"(",
"Request",
"$",
"request",
",",
"Response",
"$",
"response",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"cspDisabled",
")",
"{",
"$",
"this",
"->",
"removeCspHeaders",
"(",
"$",
"response",
")",
";",
"return... | Cleanup temporary headers and updates Content-Security-Policy headers.
@return array Nonces used by the bundle in Content-Security-Policy header | [
"Cleanup",
"temporary",
"headers",
"and",
"updates",
"Content",
"-",
"Security",
"-",
"Policy",
"headers",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Bundle/WebProfilerBundle/Csp/ContentSecurityPolicyHandler.php#L86-L99 |
207,268 | symfony/symfony | src/Symfony/Bundle/WebProfilerBundle/Csp/ContentSecurityPolicyHandler.php | ContentSecurityPolicyHandler.updateCspHeaders | private function updateCspHeaders(Response $response, array $nonces = [])
{
$nonces = array_replace([
'csp_script_nonce' => $this->generateNonce(),
'csp_style_nonce' => $this->generateNonce(),
], $nonces);
$ruleIsSet = false;
$headers = $this->getCspHeaders(... | php | private function updateCspHeaders(Response $response, array $nonces = [])
{
$nonces = array_replace([
'csp_script_nonce' => $this->generateNonce(),
'csp_style_nonce' => $this->generateNonce(),
], $nonces);
$ruleIsSet = false;
$headers = $this->getCspHeaders(... | [
"private",
"function",
"updateCspHeaders",
"(",
"Response",
"$",
"response",
",",
"array",
"$",
"nonces",
"=",
"[",
"]",
")",
"{",
"$",
"nonces",
"=",
"array_replace",
"(",
"[",
"'csp_script_nonce'",
"=>",
"$",
"this",
"->",
"generateNonce",
"(",
")",
",",... | Updates Content-Security-Policy headers in a response.
@return array | [
"Updates",
"Content",
"-",
"Security",
"-",
"Policy",
"headers",
"in",
"a",
"response",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Bundle/WebProfilerBundle/Csp/ContentSecurityPolicyHandler.php#L119-L160 |
207,269 | symfony/symfony | src/Symfony/Bundle/WebProfilerBundle/Csp/ContentSecurityPolicyHandler.php | ContentSecurityPolicyHandler.generateCspHeader | private function generateCspHeader(array $directives)
{
return array_reduce(array_keys($directives), function ($res, $name) use ($directives) {
return ('' !== $res ? $res.'; ' : '').sprintf('%s %s', $name, implode(' ', $directives[$name]));
}, '');
} | php | private function generateCspHeader(array $directives)
{
return array_reduce(array_keys($directives), function ($res, $name) use ($directives) {
return ('' !== $res ? $res.'; ' : '').sprintf('%s %s', $name, implode(' ', $directives[$name]));
}, '');
} | [
"private",
"function",
"generateCspHeader",
"(",
"array",
"$",
"directives",
")",
"{",
"return",
"array_reduce",
"(",
"array_keys",
"(",
"$",
"directives",
")",
",",
"function",
"(",
"$",
"res",
",",
"$",
"name",
")",
"use",
"(",
"$",
"directives",
")",
... | Converts a directive set array into Content-Security-Policy header.
@param array $directives The directive set
@return string The Content-Security-Policy header | [
"Converts",
"a",
"directive",
"set",
"array",
"into",
"Content",
"-",
"Security",
"-",
"Policy",
"header",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Bundle/WebProfilerBundle/Csp/ContentSecurityPolicyHandler.php#L179-L184 |
207,270 | symfony/symfony | src/Symfony/Bundle/WebProfilerBundle/Csp/ContentSecurityPolicyHandler.php | ContentSecurityPolicyHandler.parseDirectives | private function parseDirectives($header)
{
$directives = [];
foreach (explode(';', $header) as $directive) {
$parts = explode(' ', trim($directive));
if (\count($parts) < 1) {
continue;
}
$name = array_shift($parts);
$dire... | php | private function parseDirectives($header)
{
$directives = [];
foreach (explode(';', $header) as $directive) {
$parts = explode(' ', trim($directive));
if (\count($parts) < 1) {
continue;
}
$name = array_shift($parts);
$dire... | [
"private",
"function",
"parseDirectives",
"(",
"$",
"header",
")",
"{",
"$",
"directives",
"=",
"[",
"]",
";",
"foreach",
"(",
"explode",
"(",
"';'",
",",
"$",
"header",
")",
"as",
"$",
"directive",
")",
"{",
"$",
"parts",
"=",
"explode",
"(",
"' '",... | Converts a Content-Security-Policy header value into a directive set array.
@param string $header The header value
@return array The directive set | [
"Converts",
"a",
"Content",
"-",
"Security",
"-",
"Policy",
"header",
"value",
"into",
"a",
"directive",
"set",
"array",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Bundle/WebProfilerBundle/Csp/ContentSecurityPolicyHandler.php#L193-L207 |
207,271 | symfony/symfony | src/Symfony/Bundle/WebProfilerBundle/Csp/ContentSecurityPolicyHandler.php | ContentSecurityPolicyHandler.authorizesInline | private function authorizesInline(array $directivesSet, $type)
{
if (isset($directivesSet[$type])) {
$directives = $directivesSet[$type];
} elseif (isset($directivesSet['default-src'])) {
$directives = $directivesSet['default-src'];
} else {
return false;
... | php | private function authorizesInline(array $directivesSet, $type)
{
if (isset($directivesSet[$type])) {
$directives = $directivesSet[$type];
} elseif (isset($directivesSet['default-src'])) {
$directives = $directivesSet['default-src'];
} else {
return false;
... | [
"private",
"function",
"authorizesInline",
"(",
"array",
"$",
"directivesSet",
",",
"$",
"type",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"directivesSet",
"[",
"$",
"type",
"]",
")",
")",
"{",
"$",
"directives",
"=",
"$",
"directivesSet",
"[",
"$",
"typ... | Detects if the 'unsafe-inline' is prevented for a directive within the directive set.
@param array $directivesSet The directive set
@param string $type The name of the directive to check
@return bool | [
"Detects",
"if",
"the",
"unsafe",
"-",
"inline",
"is",
"prevented",
"for",
"a",
"directive",
"within",
"the",
"directive",
"set",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Bundle/WebProfilerBundle/Csp/ContentSecurityPolicyHandler.php#L217-L228 |
207,272 | symfony/symfony | src/Symfony/Component/HttpKernel/HttpCache/ResponseCacheStrategy.php | ResponseCacheStrategy.willMakeFinalResponseUncacheable | private function willMakeFinalResponseUncacheable(Response $response)
{
// RFC2616: A response received with a status code of 200, 203, 300, 301 or 410
// MAY be stored by a cache [β¦] unless a cache-control directive prohibits caching.
if ($response->headers->hasCacheControlDirective('no-cac... | php | private function willMakeFinalResponseUncacheable(Response $response)
{
// RFC2616: A response received with a status code of 200, 203, 300, 301 or 410
// MAY be stored by a cache [β¦] unless a cache-control directive prohibits caching.
if ($response->headers->hasCacheControlDirective('no-cac... | [
"private",
"function",
"willMakeFinalResponseUncacheable",
"(",
"Response",
"$",
"response",
")",
"{",
"// RFC2616: A response received with a status code of 200, 203, 300, 301 or 410",
"// MAY be stored by a cache [β¦] unless a cache-control directive prohibits caching.",
"if",
"(",
"$",
... | RFC2616, Section 13.4.
@see https://www.w3.org/Protocols/rfc2616/rfc2616-sec13.html#sec13.4
@return bool | [
"RFC2616",
"Section",
"13",
".",
"4",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/HttpKernel/HttpCache/ResponseCacheStrategy.php#L162-L196 |
207,273 | symfony/symfony | src/Symfony/Component/Console/Question/ConfirmationQuestion.php | ConfirmationQuestion.getDefaultNormalizer | private function getDefaultNormalizer()
{
$default = $this->getDefault();
$regex = $this->trueAnswerRegex;
return function ($answer) use ($default, $regex) {
if (\is_bool($answer)) {
return $answer;
}
$answerIsTrue = (bool) preg_match($re... | php | private function getDefaultNormalizer()
{
$default = $this->getDefault();
$regex = $this->trueAnswerRegex;
return function ($answer) use ($default, $regex) {
if (\is_bool($answer)) {
return $answer;
}
$answerIsTrue = (bool) preg_match($re... | [
"private",
"function",
"getDefaultNormalizer",
"(",
")",
"{",
"$",
"default",
"=",
"$",
"this",
"->",
"getDefault",
"(",
")",
";",
"$",
"regex",
"=",
"$",
"this",
"->",
"trueAnswerRegex",
";",
"return",
"function",
"(",
"$",
"answer",
")",
"use",
"(",
... | Returns the default answer normalizer.
@return callable | [
"Returns",
"the",
"default",
"answer",
"normalizer",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Console/Question/ConfirmationQuestion.php#L41-L58 |
207,274 | symfony/symfony | src/Symfony/Component/HttpFoundation/Session/Storage/Handler/PdoSessionHandler.php | PdoSessionHandler.buildDsnFromUrl | private function buildDsnFromUrl($dsnOrUrl)
{
// (pdo_)?sqlite3?:///... => (pdo_)?sqlite3?://localhost/... or else the URL will be invalid
$url = preg_replace('#^((?:pdo_)?sqlite3?):///#', '$1://localhost/', $dsnOrUrl);
$params = parse_url($url);
if (false === $params) {
... | php | private function buildDsnFromUrl($dsnOrUrl)
{
// (pdo_)?sqlite3?:///... => (pdo_)?sqlite3?://localhost/... or else the URL will be invalid
$url = preg_replace('#^((?:pdo_)?sqlite3?):///#', '$1://localhost/', $dsnOrUrl);
$params = parse_url($url);
if (false === $params) {
... | [
"private",
"function",
"buildDsnFromUrl",
"(",
"$",
"dsnOrUrl",
")",
"{",
"// (pdo_)?sqlite3?:///... => (pdo_)?sqlite3?://localhost/... or else the URL will be invalid",
"$",
"url",
"=",
"preg_replace",
"(",
"'#^((?:pdo_)?sqlite3?):///#'",
",",
"'$1://localhost/'",
",",
"$",
"d... | Builds a PDO DSN from a URL-like connection string.
@param string $dsnOrUrl
@return string
@todo implement missing support for oci DSN (which look totally different from other PDO ones) | [
"Builds",
"a",
"PDO",
"DSN",
"from",
"a",
"URL",
"-",
"like",
"connection",
"string",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/PdoSessionHandler.php#L445-L530 |
207,275 | symfony/symfony | src/Symfony/Component/HttpFoundation/Session/Storage/Handler/PdoSessionHandler.php | PdoSessionHandler.beginTransaction | private function beginTransaction()
{
if (!$this->inTransaction) {
if ('sqlite' === $this->driver) {
$this->pdo->exec('BEGIN IMMEDIATE TRANSACTION');
} else {
if ('mysql' === $this->driver) {
$this->pdo->exec('SET TRANSACTION ISOLAT... | php | private function beginTransaction()
{
if (!$this->inTransaction) {
if ('sqlite' === $this->driver) {
$this->pdo->exec('BEGIN IMMEDIATE TRANSACTION');
} else {
if ('mysql' === $this->driver) {
$this->pdo->exec('SET TRANSACTION ISOLAT... | [
"private",
"function",
"beginTransaction",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"inTransaction",
")",
"{",
"if",
"(",
"'sqlite'",
"===",
"$",
"this",
"->",
"driver",
")",
"{",
"$",
"this",
"->",
"pdo",
"->",
"exec",
"(",
"'BEGIN IMMEDIATE ... | Helper method to begin a transaction.
Since SQLite does not support row level locks, we have to acquire a reserved lock
on the database immediately. Because of https://bugs.php.net/42766 we have to create
such a transaction manually which also means we cannot use PDO::commit or
PDO::rollback or PDO::inTransaction for ... | [
"Helper",
"method",
"to",
"begin",
"a",
"transaction",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/PdoSessionHandler.php#L544-L557 |
207,276 | symfony/symfony | src/Symfony/Component/HttpFoundation/Session/Storage/Handler/PdoSessionHandler.php | PdoSessionHandler.commit | private function commit()
{
if ($this->inTransaction) {
try {
// commit read-write transaction which also releases the lock
if ('sqlite' === $this->driver) {
$this->pdo->exec('COMMIT');
} else {
$this->pdo->c... | php | private function commit()
{
if ($this->inTransaction) {
try {
// commit read-write transaction which also releases the lock
if ('sqlite' === $this->driver) {
$this->pdo->exec('COMMIT');
} else {
$this->pdo->c... | [
"private",
"function",
"commit",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"inTransaction",
")",
"{",
"try",
"{",
"// commit read-write transaction which also releases the lock",
"if",
"(",
"'sqlite'",
"===",
"$",
"this",
"->",
"driver",
")",
"{",
"$",
"thi... | Helper method to commit a transaction. | [
"Helper",
"method",
"to",
"commit",
"a",
"transaction",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/PdoSessionHandler.php#L562-L579 |
207,277 | symfony/symfony | src/Symfony/Component/HttpFoundation/Session/Storage/Handler/PdoSessionHandler.php | PdoSessionHandler.rollback | private function rollback()
{
// We only need to rollback if we are in a transaction. Otherwise the resulting
// error would hide the real problem why rollback was called. We might not be
// in a transaction when not using the transactional locking behavior or when
// two callbacks (... | php | private function rollback()
{
// We only need to rollback if we are in a transaction. Otherwise the resulting
// error would hide the real problem why rollback was called. We might not be
// in a transaction when not using the transactional locking behavior or when
// two callbacks (... | [
"private",
"function",
"rollback",
"(",
")",
"{",
"// We only need to rollback if we are in a transaction. Otherwise the resulting",
"// error would hide the real problem why rollback was called. We might not be",
"// in a transaction when not using the transactional locking behavior or when",
"//... | Helper method to rollback a transaction. | [
"Helper",
"method",
"to",
"rollback",
"a",
"transaction",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/PdoSessionHandler.php#L584-L598 |
207,278 | symfony/symfony | src/Symfony/Component/HttpFoundation/Session/Storage/Handler/PdoSessionHandler.php | PdoSessionHandler.doAdvisoryLock | private function doAdvisoryLock(string $sessionId)
{
switch ($this->driver) {
case 'mysql':
// MySQL 5.7.5 and later enforces a maximum length on lock names of 64 characters. Previously, no limit was enforced.
$lockId = \substr($sessionId, 0, 64);
... | php | private function doAdvisoryLock(string $sessionId)
{
switch ($this->driver) {
case 'mysql':
// MySQL 5.7.5 and later enforces a maximum length on lock names of 64 characters. Previously, no limit was enforced.
$lockId = \substr($sessionId, 0, 64);
... | [
"private",
"function",
"doAdvisoryLock",
"(",
"string",
"$",
"sessionId",
")",
"{",
"switch",
"(",
"$",
"this",
"->",
"driver",
")",
"{",
"case",
"'mysql'",
":",
"// MySQL 5.7.5 and later enforces a maximum length on lock names of 64 characters. Previously, no limit was enfor... | Executes an application-level lock on the database.
@return \PDOStatement The statement that needs to be executed later to release the lock
@throws \DomainException When an unsupported PDO driver is used
@todo implement missing advisory locks
- for oci using DBMS_LOCK.REQUEST
- for sqlsrv using sp_getapplock with Lo... | [
"Executes",
"an",
"application",
"-",
"level",
"lock",
"on",
"the",
"database",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/PdoSessionHandler.php#L679-L728 |
207,279 | symfony/symfony | src/Symfony/Component/HttpFoundation/Session/Storage/Handler/PdoSessionHandler.php | PdoSessionHandler.getInsertStatement | private function getInsertStatement($sessionId, $sessionData, $maxlifetime)
{
switch ($this->driver) {
case 'oci':
$data = fopen('php://memory', 'r+');
fwrite($data, $sessionData);
rewind($data);
$sql = "INSERT INTO $this->table ($t... | php | private function getInsertStatement($sessionId, $sessionData, $maxlifetime)
{
switch ($this->driver) {
case 'oci':
$data = fopen('php://memory', 'r+');
fwrite($data, $sessionData);
rewind($data);
$sql = "INSERT INTO $this->table ($t... | [
"private",
"function",
"getInsertStatement",
"(",
"$",
"sessionId",
",",
"$",
"sessionData",
",",
"$",
"maxlifetime",
")",
"{",
"switch",
"(",
"$",
"this",
"->",
"driver",
")",
"{",
"case",
"'oci'",
":",
"$",
"data",
"=",
"fopen",
"(",
"'php://memory'",
... | Returns an insert statement supported by the database for writing session data.
@param string $sessionId Session ID
@param string $sessionData Encoded session data
@param int $maxlifetime session.gc_maxlifetime
@return \PDOStatement The insert statement | [
"Returns",
"an",
"insert",
"statement",
"supported",
"by",
"the",
"database",
"for",
"writing",
"session",
"data",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/PdoSessionHandler.php#L784-L806 |
207,280 | PHPMailer/PHPMailer | src/PHPMailer.php | PHPMailer.isHTML | public function isHTML($isHtml = true)
{
if ($isHtml) {
$this->ContentType = static::CONTENT_TYPE_TEXT_HTML;
} else {
$this->ContentType = static::CONTENT_TYPE_PLAINTEXT;
}
} | php | public function isHTML($isHtml = true)
{
if ($isHtml) {
$this->ContentType = static::CONTENT_TYPE_TEXT_HTML;
} else {
$this->ContentType = static::CONTENT_TYPE_PLAINTEXT;
}
} | [
"public",
"function",
"isHTML",
"(",
"$",
"isHtml",
"=",
"true",
")",
"{",
"if",
"(",
"$",
"isHtml",
")",
"{",
"$",
"this",
"->",
"ContentType",
"=",
"static",
"::",
"CONTENT_TYPE_TEXT_HTML",
";",
"}",
"else",
"{",
"$",
"this",
"->",
"ContentType",
"="... | Sets message type to HTML or plain.
@param bool $isHtml True for HTML mode | [
"Sets",
"message",
"type",
"to",
"HTML",
"or",
"plain",
"."
] | 3d7132341659a8a201adbc3ba11b1e202ee2857c | https://github.com/PHPMailer/PHPMailer/blob/3d7132341659a8a201adbc3ba11b1e202ee2857c/src/PHPMailer.php#L882-L889 |
207,281 | PHPMailer/PHPMailer | src/PHPMailer.php | PHPMailer.postSend | public function postSend()
{
try {
// Choose the mailer and send through it
switch ($this->Mailer) {
case 'sendmail':
case 'qmail':
return $this->sendmailSend($this->MIMEHeader, $this->MIMEBody);
case 'smtp':
... | php | public function postSend()
{
try {
// Choose the mailer and send through it
switch ($this->Mailer) {
case 'sendmail':
case 'qmail':
return $this->sendmailSend($this->MIMEHeader, $this->MIMEBody);
case 'smtp':
... | [
"public",
"function",
"postSend",
"(",
")",
"{",
"try",
"{",
"// Choose the mailer and send through it",
"switch",
"(",
"$",
"this",
"->",
"Mailer",
")",
"{",
"case",
"'sendmail'",
":",
"case",
"'qmail'",
":",
"return",
"$",
"this",
"->",
"sendmailSend",
"(",
... | Actually send a message via the selected mechanism.
@throws Exception
@return bool | [
"Actually",
"send",
"a",
"message",
"via",
"the",
"selected",
"mechanism",
"."
] | 3d7132341659a8a201adbc3ba11b1e202ee2857c | https://github.com/PHPMailer/PHPMailer/blob/3d7132341659a8a201adbc3ba11b1e202ee2857c/src/PHPMailer.php#L1530-L1559 |
207,282 | PHPMailer/PHPMailer | src/PHPMailer.php | PHPMailer.isShellSafe | protected static function isShellSafe($string)
{
// Future-proof
if (escapeshellcmd($string) !== $string
or !in_array(escapeshellarg($string), ["'$string'", "\"$string\""])
) {
return false;
}
$length = strlen($string);
for ($i = 0; $i < $len... | php | protected static function isShellSafe($string)
{
// Future-proof
if (escapeshellcmd($string) !== $string
or !in_array(escapeshellarg($string), ["'$string'", "\"$string\""])
) {
return false;
}
$length = strlen($string);
for ($i = 0; $i < $len... | [
"protected",
"static",
"function",
"isShellSafe",
"(",
"$",
"string",
")",
"{",
"// Future-proof",
"if",
"(",
"escapeshellcmd",
"(",
"$",
"string",
")",
"!==",
"$",
"string",
"or",
"!",
"in_array",
"(",
"escapeshellarg",
"(",
"$",
"string",
")",
",",
"[",
... | Fix CVE-2016-10033 and CVE-2016-10045 by disallowing potentially unsafe shell characters.
Note that escapeshellarg and escapeshellcmd are inadequate for our purposes, especially on Windows.
@see https://github.com/PHPMailer/PHPMailer/issues/924 CVE-2016-10045 bug report
@param string $string The string to be validate... | [
"Fix",
"CVE",
"-",
"2016",
"-",
"10033",
"and",
"CVE",
"-",
"2016",
"-",
"10045",
"by",
"disallowing",
"potentially",
"unsafe",
"shell",
"characters",
".",
"Note",
"that",
"escapeshellarg",
"and",
"escapeshellcmd",
"are",
"inadequate",
"for",
"our",
"purposes"... | 3d7132341659a8a201adbc3ba11b1e202ee2857c | https://github.com/PHPMailer/PHPMailer/blob/3d7132341659a8a201adbc3ba11b1e202ee2857c/src/PHPMailer.php#L1652-L1675 |
207,283 | PHPMailer/PHPMailer | src/PHPMailer.php | PHPMailer.addrAppend | public function addrAppend($type, $addr)
{
$addresses = [];
foreach ($addr as $address) {
$addresses[] = $this->addrFormat($address);
}
return $type . ': ' . implode(', ', $addresses) . static::$LE;
} | php | public function addrAppend($type, $addr)
{
$addresses = [];
foreach ($addr as $address) {
$addresses[] = $this->addrFormat($address);
}
return $type . ': ' . implode(', ', $addresses) . static::$LE;
} | [
"public",
"function",
"addrAppend",
"(",
"$",
"type",
",",
"$",
"addr",
")",
"{",
"$",
"addresses",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"addr",
"as",
"$",
"address",
")",
"{",
"$",
"addresses",
"[",
"]",
"=",
"$",
"this",
"->",
"addrFormat",
... | Create recipient headers.
@param string $type
@param array $addr An array of recipients,
where each recipient is a 2-element indexed array with element 0 containing an address
and element 1 containing a name, like:
[['joe@example.com', 'Joe User'], ['zoe@example.com', 'Zoe User']]
@return string | [
"Create",
"recipient",
"headers",
"."
] | 3d7132341659a8a201adbc3ba11b1e202ee2857c | https://github.com/PHPMailer/PHPMailer/blob/3d7132341659a8a201adbc3ba11b1e202ee2857c/src/PHPMailer.php#L2115-L2123 |
207,284 | PHPMailer/PHPMailer | src/PHPMailer.php | PHPMailer.generateId | protected function generateId()
{
$len = 32; //32 bytes = 256 bits
if (function_exists('random_bytes')) {
$bytes = random_bytes($len);
} elseif (function_exists('openssl_random_pseudo_bytes')) {
$bytes = openssl_random_pseudo_bytes($len);
} else {
... | php | protected function generateId()
{
$len = 32; //32 bytes = 256 bits
if (function_exists('random_bytes')) {
$bytes = random_bytes($len);
} elseif (function_exists('openssl_random_pseudo_bytes')) {
$bytes = openssl_random_pseudo_bytes($len);
} else {
... | [
"protected",
"function",
"generateId",
"(",
")",
"{",
"$",
"len",
"=",
"32",
";",
"//32 bytes = 256 bits",
"if",
"(",
"function_exists",
"(",
"'random_bytes'",
")",
")",
"{",
"$",
"bytes",
"=",
"random_bytes",
"(",
"$",
"len",
")",
";",
"}",
"elseif",
"(... | Create a unique ID to use for boundaries.
@return string | [
"Create",
"a",
"unique",
"ID",
"to",
"use",
"for",
"boundaries",
"."
] | 3d7132341659a8a201adbc3ba11b1e202ee2857c | https://github.com/PHPMailer/PHPMailer/blob/3d7132341659a8a201adbc3ba11b1e202ee2857c/src/PHPMailer.php#L2485-L2499 |
207,285 | PHPMailer/PHPMailer | src/PHPMailer.php | PHPMailer.cidExists | protected function cidExists($cid)
{
foreach ($this->attachment as $attachment) {
if ('inline' == $attachment[6] and $cid == $attachment[7]) {
return true;
}
}
return false;
} | php | protected function cidExists($cid)
{
foreach ($this->attachment as $attachment) {
if ('inline' == $attachment[6] and $cid == $attachment[7]) {
return true;
}
}
return false;
} | [
"protected",
"function",
"cidExists",
"(",
"$",
"cid",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"attachment",
"as",
"$",
"attachment",
")",
"{",
"if",
"(",
"'inline'",
"==",
"$",
"attachment",
"[",
"6",
"]",
"and",
"$",
"cid",
"==",
"$",
"attachm... | Check if an embedded attachment is present with this cid.
@param string $cid
@return bool | [
"Check",
"if",
"an",
"embedded",
"attachment",
"is",
"present",
"with",
"this",
"cid",
"."
] | 3d7132341659a8a201adbc3ba11b1e202ee2857c | https://github.com/PHPMailer/PHPMailer/blob/3d7132341659a8a201adbc3ba11b1e202ee2857c/src/PHPMailer.php#L3446-L3455 |
207,286 | PHPMailer/PHPMailer | src/PHPMailer.php | PHPMailer.clearBCCs | public function clearBCCs()
{
foreach ($this->bcc as $bcc) {
unset($this->all_recipients[strtolower($bcc[0])]);
}
$this->bcc = [];
$this->clearQueuedAddresses('bcc');
} | php | public function clearBCCs()
{
foreach ($this->bcc as $bcc) {
unset($this->all_recipients[strtolower($bcc[0])]);
}
$this->bcc = [];
$this->clearQueuedAddresses('bcc');
} | [
"public",
"function",
"clearBCCs",
"(",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"bcc",
"as",
"$",
"bcc",
")",
"{",
"unset",
"(",
"$",
"this",
"->",
"all_recipients",
"[",
"strtolower",
"(",
"$",
"bcc",
"[",
"0",
"]",
")",
"]",
")",
";",
"}",... | Clear all BCC recipients. | [
"Clear",
"all",
"BCC",
"recipients",
"."
] | 3d7132341659a8a201adbc3ba11b1e202ee2857c | https://github.com/PHPMailer/PHPMailer/blob/3d7132341659a8a201adbc3ba11b1e202ee2857c/src/PHPMailer.php#L3541-L3548 |
207,287 | PHPMailer/PHPMailer | src/PHPMailer.php | PHPMailer.clearAllRecipients | public function clearAllRecipients()
{
$this->to = [];
$this->cc = [];
$this->bcc = [];
$this->all_recipients = [];
$this->RecipientsQueue = [];
} | php | public function clearAllRecipients()
{
$this->to = [];
$this->cc = [];
$this->bcc = [];
$this->all_recipients = [];
$this->RecipientsQueue = [];
} | [
"public",
"function",
"clearAllRecipients",
"(",
")",
"{",
"$",
"this",
"->",
"to",
"=",
"[",
"]",
";",
"$",
"this",
"->",
"cc",
"=",
"[",
"]",
";",
"$",
"this",
"->",
"bcc",
"=",
"[",
"]",
";",
"$",
"this",
"->",
"all_recipients",
"=",
"[",
"]... | Clear all recipient types. | [
"Clear",
"all",
"recipient",
"types",
"."
] | 3d7132341659a8a201adbc3ba11b1e202ee2857c | https://github.com/PHPMailer/PHPMailer/blob/3d7132341659a8a201adbc3ba11b1e202ee2857c/src/PHPMailer.php#L3562-L3569 |
207,288 | PHPMailer/PHPMailer | src/PHPMailer.php | PHPMailer.DKIM_QP | public function DKIM_QP($txt)
{
$line = '';
$len = strlen($txt);
for ($i = 0; $i < $len; ++$i) {
$ord = ord($txt[$i]);
if (((0x21 <= $ord) and ($ord <= 0x3A)) or $ord == 0x3C or ((0x3E <= $ord) and ($ord <= 0x7E))) {
$line .= $txt[$i];
} el... | php | public function DKIM_QP($txt)
{
$line = '';
$len = strlen($txt);
for ($i = 0; $i < $len; ++$i) {
$ord = ord($txt[$i]);
if (((0x21 <= $ord) and ($ord <= 0x3A)) or $ord == 0x3C or ((0x3E <= $ord) and ($ord <= 0x7E))) {
$line .= $txt[$i];
} el... | [
"public",
"function",
"DKIM_QP",
"(",
"$",
"txt",
")",
"{",
"$",
"line",
"=",
"''",
";",
"$",
"len",
"=",
"strlen",
"(",
"$",
"txt",
")",
";",
"for",
"(",
"$",
"i",
"=",
"0",
";",
"$",
"i",
"<",
"$",
"len",
";",
"++",
"$",
"i",
")",
"{",
... | Quoted-Printable-encode a DKIM header.
@param string $txt
@return string | [
"Quoted",
"-",
"Printable",
"-",
"encode",
"a",
"DKIM",
"header",
"."
] | 3d7132341659a8a201adbc3ba11b1e202ee2857c | https://github.com/PHPMailer/PHPMailer/blob/3d7132341659a8a201adbc3ba11b1e202ee2857c/src/PHPMailer.php#L4195-L4209 |
207,289 | PHPMailer/PHPMailer | src/PHPMailer.php | PHPMailer.doCallback | protected function doCallback($isSent, $to, $cc, $bcc, $subject, $body, $from, $extra)
{
if (!empty($this->action_function) and is_callable($this->action_function)) {
call_user_func($this->action_function, $isSent, $to, $cc, $bcc, $subject, $body, $from, $extra);
}
} | php | protected function doCallback($isSent, $to, $cc, $bcc, $subject, $body, $from, $extra)
{
if (!empty($this->action_function) and is_callable($this->action_function)) {
call_user_func($this->action_function, $isSent, $to, $cc, $bcc, $subject, $body, $from, $extra);
}
} | [
"protected",
"function",
"doCallback",
"(",
"$",
"isSent",
",",
"$",
"to",
",",
"$",
"cc",
",",
"$",
"bcc",
",",
"$",
"subject",
",",
"$",
"body",
",",
"$",
"from",
",",
"$",
"extra",
")",
"{",
"if",
"(",
"!",
"empty",
"(",
"$",
"this",
"->",
... | Perform a callback.
@param bool $isSent
@param array $to
@param array $cc
@param array $bcc
@param string $subject
@param string $body
@param string $from
@param array $extra | [
"Perform",
"a",
"callback",
"."
] | 3d7132341659a8a201adbc3ba11b1e202ee2857c | https://github.com/PHPMailer/PHPMailer/blob/3d7132341659a8a201adbc3ba11b1e202ee2857c/src/PHPMailer.php#L4504-L4509 |
207,290 | PHPMailer/PHPMailer | src/SMTP.php | SMTP.setError | protected function setError($message, $detail = '', $smtp_code = '', $smtp_code_ex = '')
{
$this->error = [
'error' => $message,
'detail' => $detail,
'smtp_code' => $smtp_code,
'smtp_code_ex' => $smtp_code_ex,
];
} | php | protected function setError($message, $detail = '', $smtp_code = '', $smtp_code_ex = '')
{
$this->error = [
'error' => $message,
'detail' => $detail,
'smtp_code' => $smtp_code,
'smtp_code_ex' => $smtp_code_ex,
];
} | [
"protected",
"function",
"setError",
"(",
"$",
"message",
",",
"$",
"detail",
"=",
"''",
",",
"$",
"smtp_code",
"=",
"''",
",",
"$",
"smtp_code_ex",
"=",
"''",
")",
"{",
"$",
"this",
"->",
"error",
"=",
"[",
"'error'",
"=>",
"$",
"message",
",",
"'... | Set error messages and codes.
@param string $message The error message
@param string $detail Further detail on the error
@param string $smtp_code An associated SMTP error code
@param string $smtp_code_ex Extended SMTP code | [
"Set",
"error",
"messages",
"and",
"codes",
"."
] | 3d7132341659a8a201adbc3ba11b1e202ee2857c | https://github.com/PHPMailer/PHPMailer/blob/3d7132341659a8a201adbc3ba11b1e202ee2857c/src/SMTP.php#L1214-L1222 |
207,291 | PHPMailer/PHPMailer | src/SMTP.php | SMTP.errorHandler | protected function errorHandler($errno, $errmsg, $errfile = '', $errline = 0)
{
$notice = 'Connection failed.';
$this->setError(
$notice,
$errmsg,
(string) $errno
);
$this->edebug(
"$notice Error #$errno: $errmsg [$errfile line $errline... | php | protected function errorHandler($errno, $errmsg, $errfile = '', $errline = 0)
{
$notice = 'Connection failed.';
$this->setError(
$notice,
$errmsg,
(string) $errno
);
$this->edebug(
"$notice Error #$errno: $errmsg [$errfile line $errline... | [
"protected",
"function",
"errorHandler",
"(",
"$",
"errno",
",",
"$",
"errmsg",
",",
"$",
"errfile",
"=",
"''",
",",
"$",
"errline",
"=",
"0",
")",
"{",
"$",
"notice",
"=",
"'Connection failed.'",
";",
"$",
"this",
"->",
"setError",
"(",
"$",
"notice",... | Reports an error number and string.
@param int $errno The error number returned by PHP
@param string $errmsg The error message returned by PHP
@param string $errfile The file the error occurred in
@param int $errline The line number the error occurred on | [
"Reports",
"an",
"error",
"number",
"and",
"string",
"."
] | 3d7132341659a8a201adbc3ba11b1e202ee2857c | https://github.com/PHPMailer/PHPMailer/blob/3d7132341659a8a201adbc3ba11b1e202ee2857c/src/SMTP.php#L1292-L1304 |
207,292 | PHPMailer/PHPMailer | src/OAuth.php | OAuth.getOauth64 | public function getOauth64()
{
// Get a new token if it's not available or has expired
if (null === $this->oauthToken or $this->oauthToken->hasExpired()) {
$this->oauthToken = $this->getToken();
}
return base64_encode(
'user=' .
$this->oauthUserEm... | php | public function getOauth64()
{
// Get a new token if it's not available or has expired
if (null === $this->oauthToken or $this->oauthToken->hasExpired()) {
$this->oauthToken = $this->getToken();
}
return base64_encode(
'user=' .
$this->oauthUserEm... | [
"public",
"function",
"getOauth64",
"(",
")",
"{",
"// Get a new token if it's not available or has expired",
"if",
"(",
"null",
"===",
"$",
"this",
"->",
"oauthToken",
"or",
"$",
"this",
"->",
"oauthToken",
"->",
"hasExpired",
"(",
")",
")",
"{",
"$",
"this",
... | Generate a base64-encoded OAuth token.
@return string | [
"Generate",
"a",
"base64",
"-",
"encoded",
"OAuth",
"token",
"."
] | 3d7132341659a8a201adbc3ba11b1e202ee2857c | https://github.com/PHPMailer/PHPMailer/blob/3d7132341659a8a201adbc3ba11b1e202ee2857c/src/OAuth.php#L123-L137 |
207,293 | PHPMailer/PHPMailer | src/POP3.php | POP3.popBeforeSmtp | public static function popBeforeSmtp(
$host,
$port = false,
$timeout = false,
$username = '',
$password = '',
$debug_level = 0
) {
$pop = new self();
return $pop->authorise($host, $port, $timeout, $username, $password, $debug_level);
} | php | public static function popBeforeSmtp(
$host,
$port = false,
$timeout = false,
$username = '',
$password = '',
$debug_level = 0
) {
$pop = new self();
return $pop->authorise($host, $port, $timeout, $username, $password, $debug_level);
} | [
"public",
"static",
"function",
"popBeforeSmtp",
"(",
"$",
"host",
",",
"$",
"port",
"=",
"false",
",",
"$",
"timeout",
"=",
"false",
",",
"$",
"username",
"=",
"''",
",",
"$",
"password",
"=",
"''",
",",
"$",
"debug_level",
"=",
"0",
")",
"{",
"$"... | Simple static wrapper for all-in-one POP before SMTP.
@param string $host The hostname to connect to
@param int|bool $port The port number to connect to
@param int|bool $timeout The timeout value
@param string $username
@param string $password
@param int $debug_level
@return bool | [
"Simple",
"static",
"wrapper",
"for",
"all",
"-",
"in",
"-",
"one",
"POP",
"before",
"SMTP",
"."
] | 3d7132341659a8a201adbc3ba11b1e202ee2857c | https://github.com/PHPMailer/PHPMailer/blob/3d7132341659a8a201adbc3ba11b1e202ee2857c/src/POP3.php#L145-L156 |
207,294 | PHPMailer/PHPMailer | src/POP3.php | POP3.connect | public function connect($host, $port = false, $tval = 30)
{
// Are we already connected?
if ($this->connected) {
return true;
}
//On Windows this will raise a PHP Warning error if the hostname doesn't exist.
//Rather than suppress it with @fsockopen, capture it ... | php | public function connect($host, $port = false, $tval = 30)
{
// Are we already connected?
if ($this->connected) {
return true;
}
//On Windows this will raise a PHP Warning error if the hostname doesn't exist.
//Rather than suppress it with @fsockopen, capture it ... | [
"public",
"function",
"connect",
"(",
"$",
"host",
",",
"$",
"port",
"=",
"false",
",",
"$",
"tval",
"=",
"30",
")",
"{",
"// Are we already connected?",
"if",
"(",
"$",
"this",
"->",
"connected",
")",
"{",
"return",
"true",
";",
"}",
"//On Windows this... | Connect to a POP3 server.
@param string $host
@param int|bool $port
@param int $tval
@return bool | [
"Connect",
"to",
"a",
"POP3",
"server",
"."
] | 3d7132341659a8a201adbc3ba11b1e202ee2857c | https://github.com/PHPMailer/PHPMailer/blob/3d7132341659a8a201adbc3ba11b1e202ee2857c/src/POP3.php#L217-L267 |
207,295 | PHPMailer/PHPMailer | src/POP3.php | POP3.getResponse | protected function getResponse($size = 128)
{
$response = fgets($this->pop_conn, $size);
if ($this->do_debug >= 1) {
echo 'Server -> Client: ', $response;
}
return $response;
} | php | protected function getResponse($size = 128)
{
$response = fgets($this->pop_conn, $size);
if ($this->do_debug >= 1) {
echo 'Server -> Client: ', $response;
}
return $response;
} | [
"protected",
"function",
"getResponse",
"(",
"$",
"size",
"=",
"128",
")",
"{",
"$",
"response",
"=",
"fgets",
"(",
"$",
"this",
"->",
"pop_conn",
",",
"$",
"size",
")",
";",
"if",
"(",
"$",
"this",
"->",
"do_debug",
">=",
"1",
")",
"{",
"echo",
... | Get a response from the POP3 server.
@param int $size The maximum number of bytes to retrieve
@return string | [
"Get",
"a",
"response",
"from",
"the",
"POP3",
"server",
"."
] | 3d7132341659a8a201adbc3ba11b1e202ee2857c | https://github.com/PHPMailer/PHPMailer/blob/3d7132341659a8a201adbc3ba11b1e202ee2857c/src/POP3.php#L327-L335 |
207,296 | PHPMailer/PHPMailer | src/POP3.php | POP3.sendString | protected function sendString($string)
{
if ($this->pop_conn) {
if ($this->do_debug >= 2) { //Show client messages when debug >= 2
echo 'Client -> Server: ', $string;
}
return fwrite($this->pop_conn, $string, strlen($string));
}
return 0;... | php | protected function sendString($string)
{
if ($this->pop_conn) {
if ($this->do_debug >= 2) { //Show client messages when debug >= 2
echo 'Client -> Server: ', $string;
}
return fwrite($this->pop_conn, $string, strlen($string));
}
return 0;... | [
"protected",
"function",
"sendString",
"(",
"$",
"string",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"pop_conn",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"do_debug",
">=",
"2",
")",
"{",
"//Show client messages when debug >= 2",
"echo",
"'Client -> Server: '",
... | Send raw data to the POP3 server.
@param string $string
@return int | [
"Send",
"raw",
"data",
"to",
"the",
"POP3",
"server",
"."
] | 3d7132341659a8a201adbc3ba11b1e202ee2857c | https://github.com/PHPMailer/PHPMailer/blob/3d7132341659a8a201adbc3ba11b1e202ee2857c/src/POP3.php#L344-L355 |
207,297 | z-song/laravel-admin | src/Auth/Database/Role.php | Role.administrators | public function administrators() : BelongsToMany
{
$pivotTable = config('admin.database.role_users_table');
$relatedModel = config('admin.database.users_model');
return $this->belongsToMany($relatedModel, $pivotTable, 'role_id', 'user_id');
} | php | public function administrators() : BelongsToMany
{
$pivotTable = config('admin.database.role_users_table');
$relatedModel = config('admin.database.users_model');
return $this->belongsToMany($relatedModel, $pivotTable, 'role_id', 'user_id');
} | [
"public",
"function",
"administrators",
"(",
")",
":",
"BelongsToMany",
"{",
"$",
"pivotTable",
"=",
"config",
"(",
"'admin.database.role_users_table'",
")",
";",
"$",
"relatedModel",
"=",
"config",
"(",
"'admin.database.users_model'",
")",
";",
"return",
"$",
"th... | A role belongs to many users.
@return BelongsToMany | [
"A",
"role",
"belongs",
"to",
"many",
"users",
"."
] | 3e65086f806b54699145f58af53843e5dbbb7994 | https://github.com/z-song/laravel-admin/blob/3e65086f806b54699145f58af53843e5dbbb7994/src/Auth/Database/Role.php#L33-L40 |
207,298 | z-song/laravel-admin | src/Auth/Database/Role.php | Role.menus | public function menus() : BelongsToMany
{
$pivotTable = config('admin.database.role_menu_table');
$relatedModel = config('admin.database.menu_model');
return $this->belongsToMany($relatedModel, $pivotTable, 'role_id', 'menu_id');
} | php | public function menus() : BelongsToMany
{
$pivotTable = config('admin.database.role_menu_table');
$relatedModel = config('admin.database.menu_model');
return $this->belongsToMany($relatedModel, $pivotTable, 'role_id', 'menu_id');
} | [
"public",
"function",
"menus",
"(",
")",
":",
"BelongsToMany",
"{",
"$",
"pivotTable",
"=",
"config",
"(",
"'admin.database.role_menu_table'",
")",
";",
"$",
"relatedModel",
"=",
"config",
"(",
"'admin.database.menu_model'",
")",
";",
"return",
"$",
"this",
"->"... | A role belongs to many menus.
@return BelongsToMany | [
"A",
"role",
"belongs",
"to",
"many",
"menus",
"."
] | 3e65086f806b54699145f58af53843e5dbbb7994 | https://github.com/z-song/laravel-admin/blob/3e65086f806b54699145f58af53843e5dbbb7994/src/Auth/Database/Role.php#L61-L68 |
207,299 | z-song/laravel-admin | src/Tree.php | Tree.initBranchCallback | protected function initBranchCallback()
{
if (is_null($this->branchCallback)) {
$this->branchCallback = function ($branch) {
$key = $branch[$this->model->getKeyName()];
$title = $branch[$this->model->getTitleColumn()];
return "$key - $title";
... | php | protected function initBranchCallback()
{
if (is_null($this->branchCallback)) {
$this->branchCallback = function ($branch) {
$key = $branch[$this->model->getKeyName()];
$title = $branch[$this->model->getTitleColumn()];
return "$key - $title";
... | [
"protected",
"function",
"initBranchCallback",
"(",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"this",
"->",
"branchCallback",
")",
")",
"{",
"$",
"this",
"->",
"branchCallback",
"=",
"function",
"(",
"$",
"branch",
")",
"{",
"$",
"key",
"=",
"$",
"bran... | Initialize branch callback.
@return void | [
"Initialize",
"branch",
"callback",
"."
] | 3e65086f806b54699145f58af53843e5dbbb7994 | https://github.com/z-song/laravel-admin/blob/3e65086f806b54699145f58af53843e5dbbb7994/src/Tree.php#L113-L123 |
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.