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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
206,700 | symfony/symfony | src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/Descriptor.php | Descriptor.formatValue | protected function formatValue($value)
{
if (\is_object($value)) {
return sprintf('object(%s)', \get_class($value));
}
if (\is_string($value)) {
return $value;
}
return preg_replace("/\n\s*/s", '', var_export($value, true));
} | php | protected function formatValue($value)
{
if (\is_object($value)) {
return sprintf('object(%s)', \get_class($value));
}
if (\is_string($value)) {
return $value;
}
return preg_replace("/\n\s*/s", '', var_export($value, true));
} | [
"protected",
"function",
"formatValue",
"(",
"$",
"value",
")",
"{",
"if",
"(",
"\\",
"is_object",
"(",
"$",
"value",
")",
")",
"{",
"return",
"sprintf",
"(",
"'object(%s)'",
",",
"\\",
"get_class",
"(",
"$",
"value",
")",
")",
";",
"}",
"if",
"(",
... | Formats a value as string.
@param mixed $value
@return string | [
"Formats",
"a",
"value",
"as",
"string",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/Descriptor.php#L191-L202 |
206,701 | symfony/symfony | src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/Descriptor.php | Descriptor.formatParameter | protected function formatParameter($value)
{
if (\is_bool($value) || \is_array($value) || (null === $value)) {
$jsonString = json_encode($value);
if (preg_match('/^(.{60})./us', $jsonString, $matches)) {
return $matches[1].'...';
}
return $js... | php | protected function formatParameter($value)
{
if (\is_bool($value) || \is_array($value) || (null === $value)) {
$jsonString = json_encode($value);
if (preg_match('/^(.{60})./us', $jsonString, $matches)) {
return $matches[1].'...';
}
return $js... | [
"protected",
"function",
"formatParameter",
"(",
"$",
"value",
")",
"{",
"if",
"(",
"\\",
"is_bool",
"(",
"$",
"value",
")",
"||",
"\\",
"is_array",
"(",
"$",
"value",
")",
"||",
"(",
"null",
"===",
"$",
"value",
")",
")",
"{",
"$",
"jsonString",
"... | Formats a parameter.
@param mixed $value
@return string | [
"Formats",
"a",
"parameter",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/Descriptor.php#L211-L224 |
206,702 | symfony/symfony | src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/Descriptor.php | Descriptor.getClassDescription | public static function getClassDescription(string $class, string &$resolvedClass = null): string
{
$resolvedClass = $class;
try {
$resource = new ClassExistenceResource($class, false);
// isFresh() will explode ONLY if a parent class/trait does not exist
$resourc... | php | public static function getClassDescription(string $class, string &$resolvedClass = null): string
{
$resolvedClass = $class;
try {
$resource = new ClassExistenceResource($class, false);
// isFresh() will explode ONLY if a parent class/trait does not exist
$resourc... | [
"public",
"static",
"function",
"getClassDescription",
"(",
"string",
"$",
"class",
",",
"string",
"&",
"$",
"resolvedClass",
"=",
"null",
")",
":",
"string",
"{",
"$",
"resolvedClass",
"=",
"$",
"class",
";",
"try",
"{",
"$",
"resource",
"=",
"new",
"Cl... | Gets class description from a docblock. | [
"Gets",
"class",
"description",
"from",
"a",
"docblock",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/Descriptor.php#L300-L321 |
206,703 | symfony/symfony | src/Symfony/Component/DependencyInjection/Loader/Configurator/Traits/ParentTrait.php | ParentTrait.parent | final public function parent(string $parent)
{
if (!$this->allowParent) {
throw new InvalidArgumentException(sprintf('A parent cannot be defined when either "_instanceof" or "_defaults" are also defined for service prototype "%s".', $this->id));
}
if ($this->definition instanceo... | php | final public function parent(string $parent)
{
if (!$this->allowParent) {
throw new InvalidArgumentException(sprintf('A parent cannot be defined when either "_instanceof" or "_defaults" are also defined for service prototype "%s".', $this->id));
}
if ($this->definition instanceo... | [
"final",
"public",
"function",
"parent",
"(",
"string",
"$",
"parent",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"allowParent",
")",
"{",
"throw",
"new",
"InvalidArgumentException",
"(",
"sprintf",
"(",
"'A parent cannot be defined when either \"_instanceof\" or ... | Sets the Definition to inherit from.
@return $this
@throws InvalidArgumentException when parent cannot be set | [
"Sets",
"the",
"Definition",
"to",
"inherit",
"from",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/DependencyInjection/Loader/Configurator/Traits/ParentTrait.php#L26-L49 |
206,704 | symfony/symfony | src/Symfony/Component/Validator/Mapping/Loader/FilesLoader.php | FilesLoader.getFileLoaders | protected function getFileLoaders($paths)
{
$loaders = [];
foreach ($paths as $path) {
$loaders[] = $this->getFileLoaderInstance($path);
}
return $loaders;
} | php | protected function getFileLoaders($paths)
{
$loaders = [];
foreach ($paths as $path) {
$loaders[] = $this->getFileLoaderInstance($path);
}
return $loaders;
} | [
"protected",
"function",
"getFileLoaders",
"(",
"$",
"paths",
")",
"{",
"$",
"loaders",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"paths",
"as",
"$",
"path",
")",
"{",
"$",
"loaders",
"[",
"]",
"=",
"$",
"this",
"->",
"getFileLoaderInstance",
"(",
"$"... | Returns an array of file loaders for the given file paths.
@param array $paths An array of file paths
@return LoaderInterface[] The metadata loaders | [
"Returns",
"an",
"array",
"of",
"file",
"loaders",
"for",
"the",
"given",
"file",
"paths",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Validator/Mapping/Loader/FilesLoader.php#L42-L51 |
206,705 | symfony/symfony | src/Symfony/Component/DomCrawler/Crawler.php | Crawler.addXmlContent | public function addXmlContent($content, $charset = 'UTF-8', $options = LIBXML_NONET)
{
// remove the default namespace if it's the only namespace to make XPath expressions simpler
if (!preg_match('/xmlns:/', $content)) {
$content = str_replace('xmlns', 'ns', $content);
}
... | php | public function addXmlContent($content, $charset = 'UTF-8', $options = LIBXML_NONET)
{
// remove the default namespace if it's the only namespace to make XPath expressions simpler
if (!preg_match('/xmlns:/', $content)) {
$content = str_replace('xmlns', 'ns', $content);
}
... | [
"public",
"function",
"addXmlContent",
"(",
"$",
"content",
",",
"$",
"charset",
"=",
"'UTF-8'",
",",
"$",
"options",
"=",
"LIBXML_NONET",
")",
"{",
"// remove the default namespace if it's the only namespace to make XPath expressions simpler",
"if",
"(",
"!",
"preg_match... | Adds an XML content to the list of nodes.
The libxml errors are disabled when the content is parsed.
If you want to get parsing errors, be sure to enable
internal errors via libxml_use_internal_errors(true)
and then, get the errors via libxml_get_errors(). Be
sure to clear errors with libxml_clear_errors() afterward.... | [
"Adds",
"an",
"XML",
"content",
"to",
"the",
"list",
"of",
"nodes",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/DomCrawler/Crawler.php#L233-L256 |
206,706 | symfony/symfony | src/Symfony/Component/DomCrawler/Crawler.php | Crawler.addNodeList | public function addNodeList(\DOMNodeList $nodes)
{
foreach ($nodes as $node) {
if ($node instanceof \DOMNode) {
$this->addNode($node);
}
}
} | php | public function addNodeList(\DOMNodeList $nodes)
{
foreach ($nodes as $node) {
if ($node instanceof \DOMNode) {
$this->addNode($node);
}
}
} | [
"public",
"function",
"addNodeList",
"(",
"\\",
"DOMNodeList",
"$",
"nodes",
")",
"{",
"foreach",
"(",
"$",
"nodes",
"as",
"$",
"node",
")",
"{",
"if",
"(",
"$",
"node",
"instanceof",
"\\",
"DOMNode",
")",
"{",
"$",
"this",
"->",
"addNode",
"(",
"$",... | Adds a \DOMNodeList to the list of nodes.
@param \DOMNodeList $nodes A \DOMNodeList instance | [
"Adds",
"a",
"\\",
"DOMNodeList",
"to",
"the",
"list",
"of",
"nodes",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/DomCrawler/Crawler.php#L275-L282 |
206,707 | symfony/symfony | src/Symfony/Component/DomCrawler/Crawler.php | Crawler.eq | public function eq($position)
{
if (isset($this->nodes[$position])) {
return $this->createSubCrawler($this->nodes[$position]);
}
return $this->createSubCrawler(null);
} | php | public function eq($position)
{
if (isset($this->nodes[$position])) {
return $this->createSubCrawler($this->nodes[$position]);
}
return $this->createSubCrawler(null);
} | [
"public",
"function",
"eq",
"(",
"$",
"position",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"nodes",
"[",
"$",
"position",
"]",
")",
")",
"{",
"return",
"$",
"this",
"->",
"createSubCrawler",
"(",
"$",
"this",
"->",
"nodes",
"[",
"$",
... | Returns a node given its position in the node list.
@param int $position The position
@return self | [
"Returns",
"a",
"node",
"given",
"its",
"position",
"in",
"the",
"node",
"list",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/DomCrawler/Crawler.php#L330-L337 |
206,708 | symfony/symfony | src/Symfony/Component/DomCrawler/Crawler.php | Crawler.each | public function each(\Closure $closure)
{
$data = [];
foreach ($this->nodes as $i => $node) {
$data[] = $closure($this->createSubCrawler($node), $i);
}
return $data;
} | php | public function each(\Closure $closure)
{
$data = [];
foreach ($this->nodes as $i => $node) {
$data[] = $closure($this->createSubCrawler($node), $i);
}
return $data;
} | [
"public",
"function",
"each",
"(",
"\\",
"Closure",
"$",
"closure",
")",
"{",
"$",
"data",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"this",
"->",
"nodes",
"as",
"$",
"i",
"=>",
"$",
"node",
")",
"{",
"$",
"data",
"[",
"]",
"=",
"$",
"closure",
... | Calls an anonymous function on each node of the list.
The anonymous function receives the position and the node wrapped
in a Crawler instance as arguments.
Example:
$crawler->filter('h1')->each(function ($node, $i) {
return $node->text();
});
@param \Closure $closure An anonymous function
@return array An array of... | [
"Calls",
"an",
"anonymous",
"function",
"on",
"each",
"node",
"of",
"the",
"list",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/DomCrawler/Crawler.php#L355-L363 |
206,709 | symfony/symfony | src/Symfony/Component/DomCrawler/Crawler.php | Crawler.reduce | public function reduce(\Closure $closure)
{
$nodes = [];
foreach ($this->nodes as $i => $node) {
if (false !== $closure($this->createSubCrawler($node), $i)) {
$nodes[] = $node;
}
}
return $this->createSubCrawler($nodes);
} | php | public function reduce(\Closure $closure)
{
$nodes = [];
foreach ($this->nodes as $i => $node) {
if (false !== $closure($this->createSubCrawler($node), $i)) {
$nodes[] = $node;
}
}
return $this->createSubCrawler($nodes);
} | [
"public",
"function",
"reduce",
"(",
"\\",
"Closure",
"$",
"closure",
")",
"{",
"$",
"nodes",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"this",
"->",
"nodes",
"as",
"$",
"i",
"=>",
"$",
"node",
")",
"{",
"if",
"(",
"false",
"!==",
"$",
"closure",
... | Reduces the list of nodes by calling an anonymous function.
To remove a node from the list, the anonymous function must return false.
@param \Closure $closure An anonymous function
@return self | [
"Reduces",
"the",
"list",
"of",
"nodes",
"by",
"calling",
"an",
"anonymous",
"function",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/DomCrawler/Crawler.php#L387-L397 |
206,710 | symfony/symfony | src/Symfony/Component/DomCrawler/Crawler.php | Crawler.siblings | public function siblings()
{
if (!$this->nodes) {
throw new \InvalidArgumentException('The current node list is empty.');
}
return $this->createSubCrawler($this->sibling($this->getNode(0)->parentNode->firstChild));
} | php | public function siblings()
{
if (!$this->nodes) {
throw new \InvalidArgumentException('The current node list is empty.');
}
return $this->createSubCrawler($this->sibling($this->getNode(0)->parentNode->firstChild));
} | [
"public",
"function",
"siblings",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"nodes",
")",
"{",
"throw",
"new",
"\\",
"InvalidArgumentException",
"(",
"'The current node list is empty.'",
")",
";",
"}",
"return",
"$",
"this",
"->",
"createSubCrawler",
... | Returns the siblings nodes of the current selection.
@return self
@throws \InvalidArgumentException When current node is empty | [
"Returns",
"the",
"siblings",
"nodes",
"of",
"the",
"current",
"selection",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/DomCrawler/Crawler.php#L426-L433 |
206,711 | symfony/symfony | src/Symfony/Component/DomCrawler/Crawler.php | Crawler.nextAll | public function nextAll()
{
if (!$this->nodes) {
throw new \InvalidArgumentException('The current node list is empty.');
}
return $this->createSubCrawler($this->sibling($this->getNode(0)));
} | php | public function nextAll()
{
if (!$this->nodes) {
throw new \InvalidArgumentException('The current node list is empty.');
}
return $this->createSubCrawler($this->sibling($this->getNode(0)));
} | [
"public",
"function",
"nextAll",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"nodes",
")",
"{",
"throw",
"new",
"\\",
"InvalidArgumentException",
"(",
"'The current node list is empty.'",
")",
";",
"}",
"return",
"$",
"this",
"->",
"createSubCrawler",
... | Returns the next siblings nodes of the current selection.
@return self
@throws \InvalidArgumentException When current node is empty | [
"Returns",
"the",
"next",
"siblings",
"nodes",
"of",
"the",
"current",
"selection",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/DomCrawler/Crawler.php#L442-L449 |
206,712 | symfony/symfony | src/Symfony/Component/DomCrawler/Crawler.php | Crawler.previousAll | public function previousAll()
{
if (!$this->nodes) {
throw new \InvalidArgumentException('The current node list is empty.');
}
return $this->createSubCrawler($this->sibling($this->getNode(0), 'previousSibling'));
} | php | public function previousAll()
{
if (!$this->nodes) {
throw new \InvalidArgumentException('The current node list is empty.');
}
return $this->createSubCrawler($this->sibling($this->getNode(0), 'previousSibling'));
} | [
"public",
"function",
"previousAll",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"nodes",
")",
"{",
"throw",
"new",
"\\",
"InvalidArgumentException",
"(",
"'The current node list is empty.'",
")",
";",
"}",
"return",
"$",
"this",
"->",
"createSubCrawler"... | Returns the previous sibling nodes of the current selection.
@return self
@throws \InvalidArgumentException | [
"Returns",
"the",
"previous",
"sibling",
"nodes",
"of",
"the",
"current",
"selection",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/DomCrawler/Crawler.php#L458-L465 |
206,713 | symfony/symfony | src/Symfony/Component/DomCrawler/Crawler.php | Crawler.extract | public function extract($attributes)
{
$attributes = (array) $attributes;
$count = \count($attributes);
$data = [];
foreach ($this->nodes as $node) {
$elements = [];
foreach ($attributes as $attribute) {
if ('_text' === $attribute) {
... | php | public function extract($attributes)
{
$attributes = (array) $attributes;
$count = \count($attributes);
$data = [];
foreach ($this->nodes as $node) {
$elements = [];
foreach ($attributes as $attribute) {
if ('_text' === $attribute) {
... | [
"public",
"function",
"extract",
"(",
"$",
"attributes",
")",
"{",
"$",
"attributes",
"=",
"(",
"array",
")",
"$",
"attributes",
";",
"$",
"count",
"=",
"\\",
"count",
"(",
"$",
"attributes",
")",
";",
"$",
"data",
"=",
"[",
"]",
";",
"foreach",
"(... | Extracts information from the list of nodes.
You can extract attributes or/and the node value (_text).
Example:
$crawler->filter('h1 a')->extract(['_text', 'href']);
@param array $attributes An array of attributes
@return array An array of extracted values | [
"Extracts",
"information",
"from",
"the",
"list",
"of",
"nodes",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/DomCrawler/Crawler.php#L662-L684 |
206,714 | symfony/symfony | src/Symfony/Component/DomCrawler/Crawler.php | Crawler.image | public function image()
{
if (!\count($this)) {
throw new \InvalidArgumentException('The current node list is empty.');
}
$node = $this->getNode(0);
if (!$node instanceof \DOMElement) {
throw new \InvalidArgumentException(sprintf('The selected node should be... | php | public function image()
{
if (!\count($this)) {
throw new \InvalidArgumentException('The current node list is empty.');
}
$node = $this->getNode(0);
if (!$node instanceof \DOMElement) {
throw new \InvalidArgumentException(sprintf('The selected node should be... | [
"public",
"function",
"image",
"(",
")",
"{",
"if",
"(",
"!",
"\\",
"count",
"(",
"$",
"this",
")",
")",
"{",
"throw",
"new",
"\\",
"InvalidArgumentException",
"(",
"'The current node list is empty.'",
")",
";",
"}",
"$",
"node",
"=",
"$",
"this",
"->",
... | Returns an Image object for the first node in the list.
@return Image An Image instance
@throws \InvalidArgumentException If the current node list is empty | [
"Returns",
"an",
"Image",
"object",
"for",
"the",
"first",
"node",
"in",
"the",
"list",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/DomCrawler/Crawler.php#L823-L836 |
206,715 | symfony/symfony | src/Symfony/Component/DomCrawler/Crawler.php | Crawler.images | public function images()
{
$images = [];
foreach ($this as $node) {
if (!$node instanceof \DOMElement) {
throw new \InvalidArgumentException(sprintf('The current node list should contain only DOMElement instances, "%s" found.', \get_class($node)));
}
... | php | public function images()
{
$images = [];
foreach ($this as $node) {
if (!$node instanceof \DOMElement) {
throw new \InvalidArgumentException(sprintf('The current node list should contain only DOMElement instances, "%s" found.', \get_class($node)));
}
... | [
"public",
"function",
"images",
"(",
")",
"{",
"$",
"images",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"this",
"as",
"$",
"node",
")",
"{",
"if",
"(",
"!",
"$",
"node",
"instanceof",
"\\",
"DOMElement",
")",
"{",
"throw",
"new",
"\\",
"InvalidArgum... | Returns an array of Image objects for the nodes in the list.
@return Image[] An array of Image instances | [
"Returns",
"an",
"array",
"of",
"Image",
"objects",
"for",
"the",
"nodes",
"in",
"the",
"list",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/DomCrawler/Crawler.php#L843-L855 |
206,716 | symfony/symfony | src/Symfony/Component/DomCrawler/Crawler.php | Crawler.form | public function form(array $values = null, $method = null)
{
if (!$this->nodes) {
throw new \InvalidArgumentException('The current node list is empty.');
}
$node = $this->getNode(0);
if (!$node instanceof \DOMElement) {
throw new \InvalidArgumentException(sp... | php | public function form(array $values = null, $method = null)
{
if (!$this->nodes) {
throw new \InvalidArgumentException('The current node list is empty.');
}
$node = $this->getNode(0);
if (!$node instanceof \DOMElement) {
throw new \InvalidArgumentException(sp... | [
"public",
"function",
"form",
"(",
"array",
"$",
"values",
"=",
"null",
",",
"$",
"method",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"nodes",
")",
"{",
"throw",
"new",
"\\",
"InvalidArgumentException",
"(",
"'The current node list is empty... | Returns a Form object for the first node in the list.
@param array $values An array of values for the form fields
@param string $method The method for the form
@return Form A Form instance
@throws \InvalidArgumentException If the current node list is empty or the selected node is not instance of DOMElement | [
"Returns",
"a",
"Form",
"object",
"for",
"the",
"first",
"node",
"in",
"the",
"list",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/DomCrawler/Crawler.php#L867-L886 |
206,717 | symfony/symfony | src/Symfony/Component/DomCrawler/Crawler.php | Crawler.xpathLiteral | public static function xpathLiteral($s)
{
if (false === strpos($s, "'")) {
return sprintf("'%s'", $s);
}
if (false === strpos($s, '"')) {
return sprintf('"%s"', $s);
}
$string = $s;
$parts = [];
while (true) {
if (false !=... | php | public static function xpathLiteral($s)
{
if (false === strpos($s, "'")) {
return sprintf("'%s'", $s);
}
if (false === strpos($s, '"')) {
return sprintf('"%s"', $s);
}
$string = $s;
$parts = [];
while (true) {
if (false !=... | [
"public",
"static",
"function",
"xpathLiteral",
"(",
"$",
"s",
")",
"{",
"if",
"(",
"false",
"===",
"strpos",
"(",
"$",
"s",
",",
"\"'\"",
")",
")",
"{",
"return",
"sprintf",
"(",
"\"'%s'\"",
",",
"$",
"s",
")",
";",
"}",
"if",
"(",
"false",
"===... | Converts string for XPath expressions.
Escaped characters are: quotes (") and apostrophe (').
Examples:
echo Crawler::xpathLiteral('foo " bar');
//prints 'foo " bar'
echo Crawler::xpathLiteral("foo ' bar");
//prints "foo ' bar"
echo Crawler::xpathLiteral('a\'b"c');
//prints concat('a', "'", 'b"c')
@param string ... | [
"Converts",
"string",
"for",
"XPath",
"expressions",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/DomCrawler/Crawler.php#L928-L952 |
206,718 | symfony/symfony | src/Symfony/Component/DomCrawler/Crawler.php | Crawler.convertToHtmlEntities | private function convertToHtmlEntities(string $htmlContent, string $charset = 'UTF-8'): string
{
set_error_handler(function () { throw new \Exception(); });
try {
return mb_convert_encoding($htmlContent, 'HTML-ENTITIES', $charset);
} catch (\Exception $e) {
try {
... | php | private function convertToHtmlEntities(string $htmlContent, string $charset = 'UTF-8'): string
{
set_error_handler(function () { throw new \Exception(); });
try {
return mb_convert_encoding($htmlContent, 'HTML-ENTITIES', $charset);
} catch (\Exception $e) {
try {
... | [
"private",
"function",
"convertToHtmlEntities",
"(",
"string",
"$",
"htmlContent",
",",
"string",
"$",
"charset",
"=",
"'UTF-8'",
")",
":",
"string",
"{",
"set_error_handler",
"(",
"function",
"(",
")",
"{",
"throw",
"new",
"\\",
"Exception",
"(",
")",
";",
... | Converts charset to HTML-entities to ensure valid parsing. | [
"Converts",
"charset",
"to",
"HTML",
"-",
"entities",
"to",
"ensure",
"valid",
"parsing",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/DomCrawler/Crawler.php#L1143-L1160 |
206,719 | symfony/symfony | src/Symfony/Component/DomCrawler/Crawler.php | Crawler.createSubCrawler | private function createSubCrawler($nodes)
{
$crawler = new static($nodes, $this->uri, $this->baseHref);
$crawler->isHtml = $this->isHtml;
$crawler->document = $this->document;
$crawler->namespaces = $this->namespaces;
$crawler->html5Parser = $this->html5Parser;
retur... | php | private function createSubCrawler($nodes)
{
$crawler = new static($nodes, $this->uri, $this->baseHref);
$crawler->isHtml = $this->isHtml;
$crawler->document = $this->document;
$crawler->namespaces = $this->namespaces;
$crawler->html5Parser = $this->html5Parser;
retur... | [
"private",
"function",
"createSubCrawler",
"(",
"$",
"nodes",
")",
"{",
"$",
"crawler",
"=",
"new",
"static",
"(",
"$",
"nodes",
",",
"$",
"this",
"->",
"uri",
",",
"$",
"this",
"->",
"baseHref",
")",
";",
"$",
"crawler",
"->",
"isHtml",
"=",
"$",
... | Creates a crawler for some subnodes.
@param \DOMElement|\DOMElement[]|\DOMNodeList|null $nodes
@return static | [
"Creates",
"a",
"crawler",
"for",
"some",
"subnodes",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/DomCrawler/Crawler.php#L1214-L1223 |
206,720 | symfony/symfony | src/Symfony/Component/Process/Process.php | Process.fromShellCommandline | public static function fromShellCommandline(string $command, string $cwd = null, array $env = null, $input = null, ?float $timeout = 60)
{
$process = new static([], $cwd, $env, $input, $timeout);
$process->commandline = $command;
return $process;
} | php | public static function fromShellCommandline(string $command, string $cwd = null, array $env = null, $input = null, ?float $timeout = 60)
{
$process = new static([], $cwd, $env, $input, $timeout);
$process->commandline = $command;
return $process;
} | [
"public",
"static",
"function",
"fromShellCommandline",
"(",
"string",
"$",
"command",
",",
"string",
"$",
"cwd",
"=",
"null",
",",
"array",
"$",
"env",
"=",
"null",
",",
"$",
"input",
"=",
"null",
",",
"?",
"float",
"$",
"timeout",
"=",
"60",
")",
"... | Creates a Process instance as a command-line to be run in a shell wrapper.
Command-lines are parsed by the shell of your OS (/bin/sh on Unix-like, cmd.exe on Windows.)
This allows using e.g. pipes or conditional execution. In this mode, signals are sent to the
shell wrapper and not to your commands.
In order to injec... | [
"Creates",
"a",
"Process",
"instance",
"as",
"a",
"command",
"-",
"line",
"to",
"be",
"run",
"in",
"a",
"shell",
"wrapper",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Process/Process.php#L191-L197 |
206,721 | symfony/symfony | src/Symfony/Component/Process/Process.php | Process.waitUntil | public function waitUntil(callable $callback): bool
{
$this->requireProcessIsStarted(__FUNCTION__);
$this->updateStatus(false);
if (!$this->processPipes->haveReadSupport()) {
$this->stop(0);
throw new \LogicException('Pass the callback to the "Process::start" method ... | php | public function waitUntil(callable $callback): bool
{
$this->requireProcessIsStarted(__FUNCTION__);
$this->updateStatus(false);
if (!$this->processPipes->haveReadSupport()) {
$this->stop(0);
throw new \LogicException('Pass the callback to the "Process::start" method ... | [
"public",
"function",
"waitUntil",
"(",
"callable",
"$",
"callback",
")",
":",
"bool",
"{",
"$",
"this",
"->",
"requireProcessIsStarted",
"(",
"__FUNCTION__",
")",
";",
"$",
"this",
"->",
"updateStatus",
"(",
"false",
")",
";",
"if",
"(",
"!",
"$",
"this... | Waits until the callback returns true.
The callback receives the type of output (out or err) and some bytes
from the output in real-time while writing the standard input to the process.
It allows to have feedback from the independent process during execution.
@throws RuntimeException When process timed out
@throws Lo... | [
"Waits",
"until",
"the",
"callback",
"returns",
"true",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Process/Process.php#L442-L475 |
206,722 | symfony/symfony | src/Symfony/Component/Process/Process.php | Process.disableOutput | public function disableOutput()
{
if ($this->isRunning()) {
throw new RuntimeException('Disabling output while the process is running is not possible.');
}
if (null !== $this->idleTimeout) {
throw new LogicException('Output can not be disabled while an idle timeout is... | php | public function disableOutput()
{
if ($this->isRunning()) {
throw new RuntimeException('Disabling output while the process is running is not possible.');
}
if (null !== $this->idleTimeout) {
throw new LogicException('Output can not be disabled while an idle timeout is... | [
"public",
"function",
"disableOutput",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"isRunning",
"(",
")",
")",
"{",
"throw",
"new",
"RuntimeException",
"(",
"'Disabling output while the process is running is not possible.'",
")",
";",
"}",
"if",
"(",
"null",
"!... | Disables fetching output and error output from the underlying process.
@return $this
@throws RuntimeException In case the process is already running
@throws LogicException if an idle timeout is set | [
"Disables",
"fetching",
"output",
"and",
"error",
"output",
"from",
"the",
"underlying",
"process",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Process/Process.php#L513-L525 |
206,723 | symfony/symfony | src/Symfony/Component/Process/Process.php | Process.getIncrementalOutput | public function getIncrementalOutput()
{
$this->readPipesForOutput(__FUNCTION__);
$latest = stream_get_contents($this->stdout, -1, $this->incrementalOutputOffset);
$this->incrementalOutputOffset = ftell($this->stdout);
if (false === $latest) {
return '';
}
... | php | public function getIncrementalOutput()
{
$this->readPipesForOutput(__FUNCTION__);
$latest = stream_get_contents($this->stdout, -1, $this->incrementalOutputOffset);
$this->incrementalOutputOffset = ftell($this->stdout);
if (false === $latest) {
return '';
}
... | [
"public",
"function",
"getIncrementalOutput",
"(",
")",
"{",
"$",
"this",
"->",
"readPipesForOutput",
"(",
"__FUNCTION__",
")",
";",
"$",
"latest",
"=",
"stream_get_contents",
"(",
"$",
"this",
"->",
"stdout",
",",
"-",
"1",
",",
"$",
"this",
"->",
"increm... | Returns the output incrementally.
In comparison with the getOutput method which always return the whole
output, this one returns the new output since the last call.
@return string The process output since the last call
@throws LogicException in case the output has been disabled
@throws LogicException In case the pro... | [
"Returns",
"the",
"output",
"incrementally",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Process/Process.php#L585-L597 |
206,724 | symfony/symfony | src/Symfony/Component/Process/Process.php | Process.getIncrementalErrorOutput | public function getIncrementalErrorOutput()
{
$this->readPipesForOutput(__FUNCTION__);
$latest = stream_get_contents($this->stderr, -1, $this->incrementalErrorOutputOffset);
$this->incrementalErrorOutputOffset = ftell($this->stderr);
if (false === $latest) {
return '';
... | php | public function getIncrementalErrorOutput()
{
$this->readPipesForOutput(__FUNCTION__);
$latest = stream_get_contents($this->stderr, -1, $this->incrementalErrorOutputOffset);
$this->incrementalErrorOutputOffset = ftell($this->stderr);
if (false === $latest) {
return '';
... | [
"public",
"function",
"getIncrementalErrorOutput",
"(",
")",
"{",
"$",
"this",
"->",
"readPipesForOutput",
"(",
"__FUNCTION__",
")",
";",
"$",
"latest",
"=",
"stream_get_contents",
"(",
"$",
"this",
"->",
"stderr",
",",
"-",
"1",
",",
"$",
"this",
"->",
"i... | Returns the errorOutput incrementally.
In comparison with the getErrorOutput method which always return the
whole error output, this one returns the new error output since the last
call.
@return string The process error output since the last call
@throws LogicException in case the output has been disabled
@throws Lo... | [
"Returns",
"the",
"errorOutput",
"incrementally",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Process/Process.php#L701-L713 |
206,725 | symfony/symfony | src/Symfony/Component/Process/Process.php | Process.getExitCodeText | public function getExitCodeText()
{
if (null === $exitcode = $this->getExitCode()) {
return;
}
return isset(self::$exitCodes[$exitcode]) ? self::$exitCodes[$exitcode] : 'Unknown error';
} | php | public function getExitCodeText()
{
if (null === $exitcode = $this->getExitCode()) {
return;
}
return isset(self::$exitCodes[$exitcode]) ? self::$exitCodes[$exitcode] : 'Unknown error';
} | [
"public",
"function",
"getExitCodeText",
"(",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"exitcode",
"=",
"$",
"this",
"->",
"getExitCode",
"(",
")",
")",
"{",
"return",
";",
"}",
"return",
"isset",
"(",
"self",
"::",
"$",
"exitCodes",
"[",
"$",
"exitc... | Returns a string representation for the exit code returned by the process.
This method relies on the Unix exit code status standardization
and might not be relevant for other operating systems.
@return string|null A string representation for the exit status code, null if the Process is not terminated
@see http://tld... | [
"Returns",
"a",
"string",
"representation",
"for",
"the",
"exit",
"code",
"returned",
"by",
"the",
"process",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Process/Process.php#L752-L759 |
206,726 | symfony/symfony | src/Symfony/Component/Process/Process.php | Process.getTermSignal | public function getTermSignal()
{
$this->requireProcessIsTerminated(__FUNCTION__);
if ($this->isSigchildEnabled() && -1 === $this->processInformation['termsig']) {
throw new RuntimeException('This PHP has been compiled with --enable-sigchild. Term signal can not be retrieved.');
... | php | public function getTermSignal()
{
$this->requireProcessIsTerminated(__FUNCTION__);
if ($this->isSigchildEnabled() && -1 === $this->processInformation['termsig']) {
throw new RuntimeException('This PHP has been compiled with --enable-sigchild. Term signal can not be retrieved.');
... | [
"public",
"function",
"getTermSignal",
"(",
")",
"{",
"$",
"this",
"->",
"requireProcessIsTerminated",
"(",
"__FUNCTION__",
")",
";",
"if",
"(",
"$",
"this",
"->",
"isSigchildEnabled",
"(",
")",
"&&",
"-",
"1",
"===",
"$",
"this",
"->",
"processInformation",... | Returns the number of the signal that caused the child process to terminate its execution.
It is only meaningful if hasBeenSignaled() returns true.
@return int
@throws RuntimeException In case --enable-sigchild is activated
@throws LogicException In case the process is not terminated | [
"Returns",
"the",
"number",
"of",
"the",
"signal",
"that",
"caused",
"the",
"child",
"process",
"to",
"terminate",
"its",
"execution",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Process/Process.php#L797-L806 |
206,727 | symfony/symfony | src/Symfony/Component/Process/Process.php | Process.isRunning | public function isRunning()
{
if (self::STATUS_STARTED !== $this->status) {
return false;
}
$this->updateStatus(false);
return $this->processInformation['running'];
} | php | public function isRunning()
{
if (self::STATUS_STARTED !== $this->status) {
return false;
}
$this->updateStatus(false);
return $this->processInformation['running'];
} | [
"public",
"function",
"isRunning",
"(",
")",
"{",
"if",
"(",
"self",
"::",
"STATUS_STARTED",
"!==",
"$",
"this",
"->",
"status",
")",
"{",
"return",
"false",
";",
"}",
"$",
"this",
"->",
"updateStatus",
"(",
"false",
")",
";",
"return",
"$",
"this",
... | Checks if the process is currently running.
@return bool true if the process is currently running, false otherwise | [
"Checks",
"if",
"the",
"process",
"is",
"currently",
"running",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Process/Process.php#L845-L854 |
206,728 | symfony/symfony | src/Symfony/Component/Process/Process.php | Process.setCommandLine | public function setCommandLine($commandline)
{
@trigger_error(sprintf('The "%s()" method is deprecated since Symfony 4.2.', __METHOD__), E_USER_DEPRECATED);
$this->commandline = $commandline;
return $this;
} | php | public function setCommandLine($commandline)
{
@trigger_error(sprintf('The "%s()" method is deprecated since Symfony 4.2.', __METHOD__), E_USER_DEPRECATED);
$this->commandline = $commandline;
return $this;
} | [
"public",
"function",
"setCommandLine",
"(",
"$",
"commandline",
")",
"{",
"@",
"trigger_error",
"(",
"sprintf",
"(",
"'The \"%s()\" method is deprecated since Symfony 4.2.'",
",",
"__METHOD__",
")",
",",
"E_USER_DEPRECATED",
")",
";",
"$",
"this",
"->",
"commandline"... | Sets the command line to be executed.
@param string|array $commandline The command to execute
@return self The current Process instance
@deprecated since Symfony 4.2. | [
"Sets",
"the",
"command",
"line",
"to",
"be",
"executed",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Process/Process.php#L976-L983 |
206,729 | symfony/symfony | src/Symfony/Component/Process/Process.php | Process.setInput | public function setInput($input)
{
if ($this->isRunning()) {
throw new LogicException('Input can not be set while the process is running.');
}
$this->input = ProcessUtils::validateInput(__METHOD__, $input);
return $this;
} | php | public function setInput($input)
{
if ($this->isRunning()) {
throw new LogicException('Input can not be set while the process is running.');
}
$this->input = ProcessUtils::validateInput(__METHOD__, $input);
return $this;
} | [
"public",
"function",
"setInput",
"(",
"$",
"input",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"isRunning",
"(",
")",
")",
"{",
"throw",
"new",
"LogicException",
"(",
"'Input can not be set while the process is running.'",
")",
";",
"}",
"$",
"this",
"->",
"in... | Sets the input.
This content will be passed to the underlying process standard input.
@param string|int|float|bool|resource|\Traversable|null $input The content
@return self The current Process instance
@throws LogicException In case the process is running | [
"Sets",
"the",
"input",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Process/Process.php#L1192-L1201 |
206,730 | symfony/symfony | src/Symfony/Component/Process/Process.php | Process.checkTimeout | public function checkTimeout()
{
if (self::STATUS_STARTED !== $this->status) {
return;
}
if (null !== $this->timeout && $this->timeout < microtime(true) - $this->starttime) {
$this->stop(0);
throw new ProcessTimedOutException($this, ProcessTimedOutExcept... | php | public function checkTimeout()
{
if (self::STATUS_STARTED !== $this->status) {
return;
}
if (null !== $this->timeout && $this->timeout < microtime(true) - $this->starttime) {
$this->stop(0);
throw new ProcessTimedOutException($this, ProcessTimedOutExcept... | [
"public",
"function",
"checkTimeout",
"(",
")",
"{",
"if",
"(",
"self",
"::",
"STATUS_STARTED",
"!==",
"$",
"this",
"->",
"status",
")",
"{",
"return",
";",
"}",
"if",
"(",
"null",
"!==",
"$",
"this",
"->",
"timeout",
"&&",
"$",
"this",
"->",
"timeou... | Performs a check between the timeout definition and the time the process started.
In case you run a background process (with the start method), you should
trigger this method regularly to ensure the process timeout
@throws ProcessTimedOutException In case the timeout was reached | [
"Performs",
"a",
"check",
"between",
"the",
"timeout",
"definition",
"and",
"the",
"time",
"the",
"process",
"started",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Process/Process.php#L1227-L1244 |
206,731 | symfony/symfony | src/Symfony/Component/Process/Process.php | Process.isTtySupported | public static function isTtySupported(): bool
{
static $isTtySupported;
if (null === $isTtySupported) {
$isTtySupported = (bool) @proc_open('echo 1 >/dev/null', [['file', '/dev/tty', 'r'], ['file', '/dev/tty', 'w'], ['file', '/dev/tty', 'w']], $pipes);
}
return $isTtySu... | php | public static function isTtySupported(): bool
{
static $isTtySupported;
if (null === $isTtySupported) {
$isTtySupported = (bool) @proc_open('echo 1 >/dev/null', [['file', '/dev/tty', 'r'], ['file', '/dev/tty', 'w'], ['file', '/dev/tty', 'w']], $pipes);
}
return $isTtySu... | [
"public",
"static",
"function",
"isTtySupported",
"(",
")",
":",
"bool",
"{",
"static",
"$",
"isTtySupported",
";",
"if",
"(",
"null",
"===",
"$",
"isTtySupported",
")",
"{",
"$",
"isTtySupported",
"=",
"(",
"bool",
")",
"@",
"proc_open",
"(",
"'echo 1 >/d... | Returns whether TTY is supported on the current operating system. | [
"Returns",
"whether",
"TTY",
"is",
"supported",
"on",
"the",
"current",
"operating",
"system",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Process/Process.php#L1249-L1258 |
206,732 | symfony/symfony | src/Symfony/Component/Process/Process.php | Process.isPtySupported | public static function isPtySupported()
{
static $result;
if (null !== $result) {
return $result;
}
if ('\\' === \DIRECTORY_SEPARATOR) {
return $result = false;
}
return $result = (bool) @proc_open('echo 1 >/dev/null', [['pty'], ['pty'], ['p... | php | public static function isPtySupported()
{
static $result;
if (null !== $result) {
return $result;
}
if ('\\' === \DIRECTORY_SEPARATOR) {
return $result = false;
}
return $result = (bool) @proc_open('echo 1 >/dev/null', [['pty'], ['pty'], ['p... | [
"public",
"static",
"function",
"isPtySupported",
"(",
")",
"{",
"static",
"$",
"result",
";",
"if",
"(",
"null",
"!==",
"$",
"result",
")",
"{",
"return",
"$",
"result",
";",
"}",
"if",
"(",
"'\\\\'",
"===",
"\\",
"DIRECTORY_SEPARATOR",
")",
"{",
"ret... | Returns whether PTY is supported on the current operating system.
@return bool | [
"Returns",
"whether",
"PTY",
"is",
"supported",
"on",
"the",
"current",
"operating",
"system",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Process/Process.php#L1265-L1278 |
206,733 | symfony/symfony | src/Symfony/Component/Process/Process.php | Process.getDescriptors | private function getDescriptors(): array
{
if ($this->input instanceof \Iterator) {
$this->input->rewind();
}
if ('\\' === \DIRECTORY_SEPARATOR) {
$this->processPipes = new WindowsPipes($this->input, !$this->outputDisabled || $this->hasCallback);
} else {
... | php | private function getDescriptors(): array
{
if ($this->input instanceof \Iterator) {
$this->input->rewind();
}
if ('\\' === \DIRECTORY_SEPARATOR) {
$this->processPipes = new WindowsPipes($this->input, !$this->outputDisabled || $this->hasCallback);
} else {
... | [
"private",
"function",
"getDescriptors",
"(",
")",
":",
"array",
"{",
"if",
"(",
"$",
"this",
"->",
"input",
"instanceof",
"\\",
"Iterator",
")",
"{",
"$",
"this",
"->",
"input",
"->",
"rewind",
"(",
")",
";",
"}",
"if",
"(",
"'\\\\'",
"===",
"\\",
... | Creates the descriptors needed by the proc_open. | [
"Creates",
"the",
"descriptors",
"needed",
"by",
"the",
"proc_open",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Process/Process.php#L1283-L1295 |
206,734 | symfony/symfony | src/Symfony/Component/Process/Process.php | Process.updateStatus | protected function updateStatus($blocking)
{
if (self::STATUS_STARTED !== $this->status) {
return;
}
$this->processInformation = proc_get_status($this->process);
$running = $this->processInformation['running'];
$this->readPipes($running && $blocking, '\\' !== \D... | php | protected function updateStatus($blocking)
{
if (self::STATUS_STARTED !== $this->status) {
return;
}
$this->processInformation = proc_get_status($this->process);
$running = $this->processInformation['running'];
$this->readPipes($running && $blocking, '\\' !== \D... | [
"protected",
"function",
"updateStatus",
"(",
"$",
"blocking",
")",
"{",
"if",
"(",
"self",
"::",
"STATUS_STARTED",
"!==",
"$",
"this",
"->",
"status",
")",
"{",
"return",
";",
"}",
"$",
"this",
"->",
"processInformation",
"=",
"proc_get_status",
"(",
"$",... | Updates the status of the process, reads pipes.
@param bool $blocking Whether to use a blocking read call | [
"Updates",
"the",
"status",
"of",
"the",
"process",
"reads",
"pipes",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Process/Process.php#L1337-L1355 |
206,735 | symfony/symfony | src/Symfony/Component/Process/Process.php | Process.validateTimeout | private function validateTimeout(?float $timeout): ?float
{
$timeout = (float) $timeout;
if (0.0 === $timeout) {
$timeout = null;
} elseif ($timeout < 0) {
throw new InvalidArgumentException('The timeout value must be a valid positive integer or float number.');
... | php | private function validateTimeout(?float $timeout): ?float
{
$timeout = (float) $timeout;
if (0.0 === $timeout) {
$timeout = null;
} elseif ($timeout < 0) {
throw new InvalidArgumentException('The timeout value must be a valid positive integer or float number.');
... | [
"private",
"function",
"validateTimeout",
"(",
"?",
"float",
"$",
"timeout",
")",
":",
"?",
"float",
"{",
"$",
"timeout",
"=",
"(",
"float",
")",
"$",
"timeout",
";",
"if",
"(",
"0.0",
"===",
"$",
"timeout",
")",
"{",
"$",
"timeout",
"=",
"null",
"... | Validates and returns the filtered timeout.
@throws InvalidArgumentException if the given timeout is a negative number | [
"Validates",
"and",
"returns",
"the",
"filtered",
"timeout",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Process/Process.php#L1402-L1413 |
206,736 | symfony/symfony | src/Symfony/Component/Process/Process.php | Process.readPipes | private function readPipes(bool $blocking, bool $close)
{
$result = $this->processPipes->readAndWrite($blocking, $close);
$callback = $this->callback;
foreach ($result as $type => $data) {
if (3 !== $type) {
$callback(self::STDOUT === $type ? self::OUT : self::ER... | php | private function readPipes(bool $blocking, bool $close)
{
$result = $this->processPipes->readAndWrite($blocking, $close);
$callback = $this->callback;
foreach ($result as $type => $data) {
if (3 !== $type) {
$callback(self::STDOUT === $type ? self::OUT : self::ER... | [
"private",
"function",
"readPipes",
"(",
"bool",
"$",
"blocking",
",",
"bool",
"$",
"close",
")",
"{",
"$",
"result",
"=",
"$",
"this",
"->",
"processPipes",
"->",
"readAndWrite",
"(",
"$",
"blocking",
",",
"$",
"close",
")",
";",
"$",
"callback",
"=",... | Reads pipes, executes callback.
@param bool $blocking Whether to use blocking calls or not
@param bool $close Whether to close file handles or not | [
"Reads",
"pipes",
"executes",
"callback",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Process/Process.php#L1421-L1433 |
206,737 | symfony/symfony | src/Symfony/Component/Process/Process.php | Process.close | private function close(): int
{
$this->processPipes->close();
if (\is_resource($this->process)) {
proc_close($this->process);
}
$this->exitcode = $this->processInformation['exitcode'];
$this->status = self::STATUS_TERMINATED;
if (-1 === $this->exitcode) {... | php | private function close(): int
{
$this->processPipes->close();
if (\is_resource($this->process)) {
proc_close($this->process);
}
$this->exitcode = $this->processInformation['exitcode'];
$this->status = self::STATUS_TERMINATED;
if (-1 === $this->exitcode) {... | [
"private",
"function",
"close",
"(",
")",
":",
"int",
"{",
"$",
"this",
"->",
"processPipes",
"->",
"close",
"(",
")",
";",
"if",
"(",
"\\",
"is_resource",
"(",
"$",
"this",
"->",
"process",
")",
")",
"{",
"proc_close",
"(",
"$",
"this",
"->",
"pro... | Closes process resource, closes file handles, sets the exitcode.
@return int The exitcode | [
"Closes",
"process",
"resource",
"closes",
"file",
"handles",
"sets",
"the",
"exitcode",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Process/Process.php#L1440-L1465 |
206,738 | symfony/symfony | src/Symfony/Component/Process/Process.php | Process.resetProcessData | private function resetProcessData()
{
$this->starttime = null;
$this->callback = null;
$this->exitcode = null;
$this->fallbackStatus = [];
$this->processInformation = null;
$this->stdout = fopen('php://temp/maxmemory:'.(1024 * 1024), 'w+b');
$this->stderr = fo... | php | private function resetProcessData()
{
$this->starttime = null;
$this->callback = null;
$this->exitcode = null;
$this->fallbackStatus = [];
$this->processInformation = null;
$this->stdout = fopen('php://temp/maxmemory:'.(1024 * 1024), 'w+b');
$this->stderr = fo... | [
"private",
"function",
"resetProcessData",
"(",
")",
"{",
"$",
"this",
"->",
"starttime",
"=",
"null",
";",
"$",
"this",
"->",
"callback",
"=",
"null",
";",
"$",
"this",
"->",
"exitcode",
"=",
"null",
";",
"$",
"this",
"->",
"fallbackStatus",
"=",
"[",... | Resets data related to the latest run of the process. | [
"Resets",
"data",
"related",
"to",
"the",
"latest",
"run",
"of",
"the",
"process",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Process/Process.php#L1470-L1484 |
206,739 | symfony/symfony | src/Symfony/Component/Process/Process.php | Process.doSignal | private function doSignal(int $signal, bool $throwException): bool
{
if (null === $pid = $this->getPid()) {
if ($throwException) {
throw new LogicException('Can not send signal on a non running process.');
}
return false;
}
if ('\\' === \... | php | private function doSignal(int $signal, bool $throwException): bool
{
if (null === $pid = $this->getPid()) {
if ($throwException) {
throw new LogicException('Can not send signal on a non running process.');
}
return false;
}
if ('\\' === \... | [
"private",
"function",
"doSignal",
"(",
"int",
"$",
"signal",
",",
"bool",
"$",
"throwException",
")",
":",
"bool",
"{",
"if",
"(",
"null",
"===",
"$",
"pid",
"=",
"$",
"this",
"->",
"getPid",
"(",
")",
")",
"{",
"if",
"(",
"$",
"throwException",
"... | Sends a POSIX signal to the process.
@param int $signal A valid POSIX signal (see http://www.php.net/manual/en/pcntl.constants.php)
@param bool $throwException Whether to throw exception in case signal failed
@return bool True if the signal was sent successfully, false otherwise
@throws LogicException In ... | [
"Sends",
"a",
"POSIX",
"signal",
"to",
"the",
"process",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Process/Process.php#L1498-L1540 |
206,740 | symfony/symfony | src/Symfony/Component/HttpKernel/HttpCache/HttpCache.php | HttpCache.getLog | public function getLog()
{
$log = [];
foreach ($this->traces as $request => $traces) {
$log[] = sprintf('%s: %s', $request, implode(', ', $traces));
}
return implode('; ', $log);
} | php | public function getLog()
{
$log = [];
foreach ($this->traces as $request => $traces) {
$log[] = sprintf('%s: %s', $request, implode(', ', $traces));
}
return implode('; ', $log);
} | [
"public",
"function",
"getLog",
"(",
")",
"{",
"$",
"log",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"this",
"->",
"traces",
"as",
"$",
"request",
"=>",
"$",
"traces",
")",
"{",
"$",
"log",
"[",
"]",
"=",
"sprintf",
"(",
"'%s: %s'",
",",
"$",
"r... | Returns a log message for the events of the last request processing.
@return string A log message | [
"Returns",
"a",
"log",
"message",
"for",
"the",
"events",
"of",
"the",
"last",
"request",
"processing",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/HttpKernel/HttpCache/HttpCache.php#L148-L156 |
206,741 | symfony/symfony | src/Symfony/Component/HttpKernel/HttpCache/HttpCache.php | HttpCache.pass | protected function pass(Request $request, $catch = false)
{
$this->record($request, 'pass');
return $this->forward($request, $catch);
} | php | protected function pass(Request $request, $catch = false)
{
$this->record($request, 'pass');
return $this->forward($request, $catch);
} | [
"protected",
"function",
"pass",
"(",
"Request",
"$",
"request",
",",
"$",
"catch",
"=",
"false",
")",
"{",
"$",
"this",
"->",
"record",
"(",
"$",
"request",
",",
"'pass'",
")",
";",
"return",
"$",
"this",
"->",
"forward",
"(",
"$",
"request",
",",
... | Forwards the Request to the backend without storing the Response in the cache.
@param Request $request A Request instance
@param bool $catch Whether to process exceptions
@return Response A Response instance | [
"Forwards",
"the",
"Request",
"to",
"the",
"backend",
"without",
"storing",
"the",
"Response",
"in",
"the",
"cache",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/HttpKernel/HttpCache/HttpCache.php#L264-L269 |
206,742 | symfony/symfony | src/Symfony/Component/HttpKernel/HttpCache/HttpCache.php | HttpCache.lookup | protected function lookup(Request $request, $catch = false)
{
try {
$entry = $this->store->lookup($request);
} catch (\Exception $e) {
$this->record($request, 'lookup-failed');
if ($this->options['debug']) {
throw $e;
}
re... | php | protected function lookup(Request $request, $catch = false)
{
try {
$entry = $this->store->lookup($request);
} catch (\Exception $e) {
$this->record($request, 'lookup-failed');
if ($this->options['debug']) {
throw $e;
}
re... | [
"protected",
"function",
"lookup",
"(",
"Request",
"$",
"request",
",",
"$",
"catch",
"=",
"false",
")",
"{",
"try",
"{",
"$",
"entry",
"=",
"$",
"this",
"->",
"store",
"->",
"lookup",
"(",
"$",
"request",
")",
";",
"}",
"catch",
"(",
"\\",
"Except... | Lookups a Response from the cache for the given Request.
When a matching cache entry is found and is fresh, it uses it as the
response without forwarding any request to the backend. When a matching
cache entry is found but is stale, it attempts to "validate" the entry with
the backend using conditional GET. When no ma... | [
"Lookups",
"a",
"Response",
"from",
"the",
"cache",
"for",
"the",
"given",
"Request",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/HttpKernel/HttpCache/HttpCache.php#L330-L361 |
206,743 | symfony/symfony | src/Symfony/Component/HttpKernel/HttpCache/HttpCache.php | HttpCache.validate | protected function validate(Request $request, Response $entry, $catch = false)
{
$subRequest = clone $request;
// send no head requests because we want content
if ('HEAD' === $request->getMethod()) {
$subRequest->setMethod('GET');
}
// add our cached last-modifi... | php | protected function validate(Request $request, Response $entry, $catch = false)
{
$subRequest = clone $request;
// send no head requests because we want content
if ('HEAD' === $request->getMethod()) {
$subRequest->setMethod('GET');
}
// add our cached last-modifi... | [
"protected",
"function",
"validate",
"(",
"Request",
"$",
"request",
",",
"Response",
"$",
"entry",
",",
"$",
"catch",
"=",
"false",
")",
"{",
"$",
"subRequest",
"=",
"clone",
"$",
"request",
";",
"// send no head requests because we want content",
"if",
"(",
... | Validates that a cache entry is fresh.
The original request is used as a template for a conditional
GET request with the backend.
@param Request $request A Request instance
@param Response $entry A Response instance to validate
@param bool $catch Whether to process exceptions
@return Response A Response ins... | [
"Validates",
"that",
"a",
"cache",
"entry",
"is",
"fresh",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/HttpKernel/HttpCache/HttpCache.php#L375-L426 |
206,744 | symfony/symfony | src/Symfony/Component/HttpKernel/HttpCache/HttpCache.php | HttpCache.fetch | protected function fetch(Request $request, $catch = false)
{
$subRequest = clone $request;
// send no head requests because we want content
if ('HEAD' === $request->getMethod()) {
$subRequest->setMethod('GET');
}
// avoid that the backend sends no content
... | php | protected function fetch(Request $request, $catch = false)
{
$subRequest = clone $request;
// send no head requests because we want content
if ('HEAD' === $request->getMethod()) {
$subRequest->setMethod('GET');
}
// avoid that the backend sends no content
... | [
"protected",
"function",
"fetch",
"(",
"Request",
"$",
"request",
",",
"$",
"catch",
"=",
"false",
")",
"{",
"$",
"subRequest",
"=",
"clone",
"$",
"request",
";",
"// send no head requests because we want content",
"if",
"(",
"'HEAD'",
"===",
"$",
"request",
"... | Unconditionally fetches a fresh response from the backend and
stores it in the cache if is cacheable.
@param Request $request A Request instance
@param bool $catch Whether to process exceptions
@return Response A Response instance | [
"Unconditionally",
"fetches",
"a",
"fresh",
"response",
"from",
"the",
"backend",
"and",
"stores",
"it",
"in",
"the",
"cache",
"if",
"is",
"cacheable",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/HttpKernel/HttpCache/HttpCache.php#L437-L457 |
206,745 | symfony/symfony | src/Symfony/Component/HttpKernel/HttpCache/HttpCache.php | HttpCache.isFreshEnough | protected function isFreshEnough(Request $request, Response $entry)
{
if (!$entry->isFresh()) {
return $this->lock($request, $entry);
}
if ($this->options['allow_revalidate'] && null !== $maxAge = $request->headers->getCacheControlDirective('max-age')) {
return $maxA... | php | protected function isFreshEnough(Request $request, Response $entry)
{
if (!$entry->isFresh()) {
return $this->lock($request, $entry);
}
if ($this->options['allow_revalidate'] && null !== $maxAge = $request->headers->getCacheControlDirective('max-age')) {
return $maxA... | [
"protected",
"function",
"isFreshEnough",
"(",
"Request",
"$",
"request",
",",
"Response",
"$",
"entry",
")",
"{",
"if",
"(",
"!",
"$",
"entry",
"->",
"isFresh",
"(",
")",
")",
"{",
"return",
"$",
"this",
"->",
"lock",
"(",
"$",
"request",
",",
"$",
... | Checks whether the cache entry is "fresh enough" to satisfy the Request.
@return bool true if the cache entry if fresh enough, false otherwise | [
"Checks",
"whether",
"the",
"cache",
"entry",
"is",
"fresh",
"enough",
"to",
"satisfy",
"the",
"Request",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/HttpKernel/HttpCache/HttpCache.php#L520-L531 |
206,746 | symfony/symfony | src/Symfony/Component/HttpKernel/HttpCache/HttpCache.php | HttpCache.lock | protected function lock(Request $request, Response $entry)
{
// try to acquire a lock to call the backend
$lock = $this->store->lock($request);
if (true === $lock) {
// we have the lock, call the backend
return false;
}
// there is already another pr... | php | protected function lock(Request $request, Response $entry)
{
// try to acquire a lock to call the backend
$lock = $this->store->lock($request);
if (true === $lock) {
// we have the lock, call the backend
return false;
}
// there is already another pr... | [
"protected",
"function",
"lock",
"(",
"Request",
"$",
"request",
",",
"Response",
"$",
"entry",
")",
"{",
"// try to acquire a lock to call the backend",
"$",
"lock",
"=",
"$",
"this",
"->",
"store",
"->",
"lock",
"(",
"$",
"request",
")",
";",
"if",
"(",
... | Locks a Request during the call to the backend.
@return bool true if the cache entry can be returned even if it is staled, false otherwise | [
"Locks",
"a",
"Request",
"during",
"the",
"call",
"to",
"the",
"backend",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/HttpKernel/HttpCache/HttpCache.php#L538-L576 |
206,747 | symfony/symfony | src/Symfony/Component/HttpKernel/HttpCache/HttpCache.php | HttpCache.store | protected function store(Request $request, Response $response)
{
try {
$this->store->write($request, $response);
$this->record($request, 'store');
$response->headers->set('Age', $response->getAge());
} catch (\Exception $e) {
$this->record($request, ... | php | protected function store(Request $request, Response $response)
{
try {
$this->store->write($request, $response);
$this->record($request, 'store');
$response->headers->set('Age', $response->getAge());
} catch (\Exception $e) {
$this->record($request, ... | [
"protected",
"function",
"store",
"(",
"Request",
"$",
"request",
",",
"Response",
"$",
"response",
")",
"{",
"try",
"{",
"$",
"this",
"->",
"store",
"->",
"write",
"(",
"$",
"request",
",",
"$",
"response",
")",
";",
"$",
"this",
"->",
"record",
"("... | Writes the Response to the cache.
@throws \Exception | [
"Writes",
"the",
"Response",
"to",
"the",
"cache",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/HttpKernel/HttpCache/HttpCache.php#L583-L601 |
206,748 | symfony/symfony | src/Symfony/Component/HttpKernel/HttpCache/HttpCache.php | HttpCache.restoreResponseBody | private function restoreResponseBody(Request $request, Response $response)
{
if ($response->headers->has('X-Body-Eval')) {
ob_start();
if ($response->headers->has('X-Body-File')) {
include $response->headers->get('X-Body-File');
} else {
e... | php | private function restoreResponseBody(Request $request, Response $response)
{
if ($response->headers->has('X-Body-Eval')) {
ob_start();
if ($response->headers->has('X-Body-File')) {
include $response->headers->get('X-Body-File');
} else {
e... | [
"private",
"function",
"restoreResponseBody",
"(",
"Request",
"$",
"request",
",",
"Response",
"$",
"response",
")",
"{",
"if",
"(",
"$",
"response",
"->",
"headers",
"->",
"has",
"(",
"'X-Body-Eval'",
")",
")",
"{",
"ob_start",
"(",
")",
";",
"if",
"(",... | Restores the Response body. | [
"Restores",
"the",
"Response",
"body",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/HttpKernel/HttpCache/HttpCache.php#L606-L633 |
206,749 | symfony/symfony | src/Symfony/Component/HttpKernel/HttpCache/HttpCache.php | HttpCache.isPrivateRequest | private function isPrivateRequest(Request $request)
{
foreach ($this->options['private_headers'] as $key) {
$key = strtolower(str_replace('HTTP_', '', $key));
if ('cookie' === $key) {
if (\count($request->cookies->all())) {
return true;
... | php | private function isPrivateRequest(Request $request)
{
foreach ($this->options['private_headers'] as $key) {
$key = strtolower(str_replace('HTTP_', '', $key));
if ('cookie' === $key) {
if (\count($request->cookies->all())) {
return true;
... | [
"private",
"function",
"isPrivateRequest",
"(",
"Request",
"$",
"request",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"options",
"[",
"'private_headers'",
"]",
"as",
"$",
"key",
")",
"{",
"$",
"key",
"=",
"strtolower",
"(",
"str_replace",
"(",
"'HTTP_'",... | Checks if the Request includes authorization or other sensitive information
that should cause the Response to be considered private by default.
@return bool true if the Request is private, false otherwise | [
"Checks",
"if",
"the",
"Request",
"includes",
"authorization",
"or",
"other",
"sensitive",
"information",
"that",
"should",
"cause",
"the",
"Response",
"to",
"be",
"considered",
"private",
"by",
"default",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/HttpKernel/HttpCache/HttpCache.php#L648-L663 |
206,750 | symfony/symfony | src/Symfony/Component/HttpKernel/HttpCache/HttpCache.php | HttpCache.record | private function record(Request $request, string $event)
{
$this->traces[$this->getTraceKey($request)][] = $event;
} | php | private function record(Request $request, string $event)
{
$this->traces[$this->getTraceKey($request)][] = $event;
} | [
"private",
"function",
"record",
"(",
"Request",
"$",
"request",
",",
"string",
"$",
"event",
")",
"{",
"$",
"this",
"->",
"traces",
"[",
"$",
"this",
"->",
"getTraceKey",
"(",
"$",
"request",
")",
"]",
"[",
"]",
"=",
"$",
"event",
";",
"}"
] | Records that an event took place. | [
"Records",
"that",
"an",
"event",
"took",
"place",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/HttpKernel/HttpCache/HttpCache.php#L668-L671 |
206,751 | symfony/symfony | src/Symfony/Component/HttpKernel/HttpCache/HttpCache.php | HttpCache.getTraceKey | private function getTraceKey(Request $request): string
{
$path = $request->getPathInfo();
if ($qs = $request->getQueryString()) {
$path .= '?'.$qs;
}
return $request->getMethod().' '.$path;
} | php | private function getTraceKey(Request $request): string
{
$path = $request->getPathInfo();
if ($qs = $request->getQueryString()) {
$path .= '?'.$qs;
}
return $request->getMethod().' '.$path;
} | [
"private",
"function",
"getTraceKey",
"(",
"Request",
"$",
"request",
")",
":",
"string",
"{",
"$",
"path",
"=",
"$",
"request",
"->",
"getPathInfo",
"(",
")",
";",
"if",
"(",
"$",
"qs",
"=",
"$",
"request",
"->",
"getQueryString",
"(",
")",
")",
"{"... | Calculates the key we use in the "trace" array for a given request. | [
"Calculates",
"the",
"key",
"we",
"use",
"in",
"the",
"trace",
"array",
"for",
"a",
"given",
"request",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/HttpKernel/HttpCache/HttpCache.php#L676-L684 |
206,752 | symfony/symfony | src/Symfony/Component/HttpKernel/HttpCache/HttpCache.php | HttpCache.waitForLock | private function waitForLock(Request $request): bool
{
$wait = 0;
while ($this->store->isLocked($request) && $wait < 100) {
usleep(50000);
++$wait;
}
return $wait < 100;
} | php | private function waitForLock(Request $request): bool
{
$wait = 0;
while ($this->store->isLocked($request) && $wait < 100) {
usleep(50000);
++$wait;
}
return $wait < 100;
} | [
"private",
"function",
"waitForLock",
"(",
"Request",
"$",
"request",
")",
":",
"bool",
"{",
"$",
"wait",
"=",
"0",
";",
"while",
"(",
"$",
"this",
"->",
"store",
"->",
"isLocked",
"(",
"$",
"request",
")",
"&&",
"$",
"wait",
"<",
"100",
")",
"{",
... | Waits for the store to release a locked entry. | [
"Waits",
"for",
"the",
"store",
"to",
"release",
"a",
"locked",
"entry",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/HttpKernel/HttpCache/HttpCache.php#L704-L713 |
206,753 | symfony/symfony | src/Symfony/Component/Config/Definition/Builder/NodeBuilder.php | NodeBuilder.node | public function node($name, $type)
{
$class = $this->getNodeClass($type);
$node = new $class($name);
$this->append($node);
return $node;
} | php | public function node($name, $type)
{
$class = $this->getNodeClass($type);
$node = new $class($name);
$this->append($node);
return $node;
} | [
"public",
"function",
"node",
"(",
"$",
"name",
",",
"$",
"type",
")",
"{",
"$",
"class",
"=",
"$",
"this",
"->",
"getNodeClass",
"(",
"$",
"type",
")",
";",
"$",
"node",
"=",
"new",
"$",
"class",
"(",
"$",
"name",
")",
";",
"$",
"this",
"->",
... | Creates a child node.
@param string|null $name The name of the node
@param string $type The type of the node
@return NodeDefinition The child node
@throws \RuntimeException When the node type is not registered
@throws \RuntimeException When the node class is not found | [
"Creates",
"a",
"child",
"node",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Config/Definition/Builder/NodeBuilder.php#L154-L163 |
206,754 | symfony/symfony | src/Symfony/Component/Config/Definition/Builder/NodeBuilder.php | NodeBuilder.getNodeClass | protected function getNodeClass($type)
{
$type = strtolower($type);
if (!isset($this->nodeMapping[$type])) {
throw new \RuntimeException(sprintf('The node type "%s" is not registered.', $type));
}
$class = $this->nodeMapping[$type];
if (!class_exists($class)) {... | php | protected function getNodeClass($type)
{
$type = strtolower($type);
if (!isset($this->nodeMapping[$type])) {
throw new \RuntimeException(sprintf('The node type "%s" is not registered.', $type));
}
$class = $this->nodeMapping[$type];
if (!class_exists($class)) {... | [
"protected",
"function",
"getNodeClass",
"(",
"$",
"type",
")",
"{",
"$",
"type",
"=",
"strtolower",
"(",
"$",
"type",
")",
";",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"nodeMapping",
"[",
"$",
"type",
"]",
")",
")",
"{",
"throw",
"new",
... | Returns the class name of the node definition.
@param string $type The node type
@return string The node definition class name
@throws \RuntimeException When the node type is not registered
@throws \RuntimeException When the node class is not found | [
"Returns",
"the",
"class",
"name",
"of",
"the",
"node",
"definition",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Config/Definition/Builder/NodeBuilder.php#L222-L237 |
206,755 | symfony/symfony | src/Symfony/Component/Form/FormError.php | FormError.setOrigin | public function setOrigin(FormInterface $origin)
{
if (null !== $this->origin) {
throw new BadMethodCallException('setOrigin() must only be called once.');
}
$this->origin = $origin;
} | php | public function setOrigin(FormInterface $origin)
{
if (null !== $this->origin) {
throw new BadMethodCallException('setOrigin() must only be called once.');
}
$this->origin = $origin;
} | [
"public",
"function",
"setOrigin",
"(",
"FormInterface",
"$",
"origin",
")",
"{",
"if",
"(",
"null",
"!==",
"$",
"this",
"->",
"origin",
")",
"{",
"throw",
"new",
"BadMethodCallException",
"(",
"'setOrigin() must only be called once.'",
")",
";",
"}",
"$",
"th... | Sets the form that caused this error.
This method must only be called once.
@param FormInterface $origin The form that caused this error
@throws BadMethodCallException If the method is called more than once | [
"Sets",
"the",
"form",
"that",
"caused",
"this",
"error",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Form/FormError.php#L118-L125 |
206,756 | symfony/symfony | src/Symfony/Component/Routing/RouteCollection.php | RouteCollection.addCollection | public function addCollection(self $collection)
{
// we need to remove all routes with the same names first because just replacing them
// would not place the new route at the end of the merged array
foreach ($collection->all() as $name => $route) {
unset($this->routes[$name]);
... | php | public function addCollection(self $collection)
{
// we need to remove all routes with the same names first because just replacing them
// would not place the new route at the end of the merged array
foreach ($collection->all() as $name => $route) {
unset($this->routes[$name]);
... | [
"public",
"function",
"addCollection",
"(",
"self",
"$",
"collection",
")",
"{",
"// we need to remove all routes with the same names first because just replacing them",
"// would not place the new route at the end of the merged array",
"foreach",
"(",
"$",
"collection",
"->",
"all",... | Adds a route collection at the end of the current set by appending all
routes of the added collection. | [
"Adds",
"a",
"route",
"collection",
"at",
"the",
"end",
"of",
"the",
"current",
"set",
"by",
"appending",
"all",
"routes",
"of",
"the",
"added",
"collection",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Routing/RouteCollection.php#L120-L132 |
206,757 | symfony/symfony | src/Symfony/Component/Routing/RouteCollection.php | RouteCollection.addPrefix | public function addPrefix($prefix, array $defaults = [], array $requirements = [])
{
$prefix = trim(trim($prefix), '/');
if ('' === $prefix) {
return;
}
foreach ($this->routes as $route) {
$route->setPath('/'.$prefix.$route->getPath());
$route->a... | php | public function addPrefix($prefix, array $defaults = [], array $requirements = [])
{
$prefix = trim(trim($prefix), '/');
if ('' === $prefix) {
return;
}
foreach ($this->routes as $route) {
$route->setPath('/'.$prefix.$route->getPath());
$route->a... | [
"public",
"function",
"addPrefix",
"(",
"$",
"prefix",
",",
"array",
"$",
"defaults",
"=",
"[",
"]",
",",
"array",
"$",
"requirements",
"=",
"[",
"]",
")",
"{",
"$",
"prefix",
"=",
"trim",
"(",
"trim",
"(",
"$",
"prefix",
")",
",",
"'/'",
")",
";... | Adds a prefix to the path of all child routes.
@param string $prefix An optional prefix to add before each pattern of the route collection
@param array $defaults An array of default values
@param array $requirements An array of requirements | [
"Adds",
"a",
"prefix",
"to",
"the",
"path",
"of",
"all",
"child",
"routes",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Routing/RouteCollection.php#L141-L154 |
206,758 | symfony/symfony | src/Symfony/Component/Routing/RouteCollection.php | RouteCollection.addNamePrefix | public function addNamePrefix(string $prefix)
{
$prefixedRoutes = [];
foreach ($this->routes as $name => $route) {
$prefixedRoutes[$prefix.$name] = $route;
if (null !== $name = $route->getDefault('_canonical_route')) {
$route->setDefault('_canonical_route', $... | php | public function addNamePrefix(string $prefix)
{
$prefixedRoutes = [];
foreach ($this->routes as $name => $route) {
$prefixedRoutes[$prefix.$name] = $route;
if (null !== $name = $route->getDefault('_canonical_route')) {
$route->setDefault('_canonical_route', $... | [
"public",
"function",
"addNamePrefix",
"(",
"string",
"$",
"prefix",
")",
"{",
"$",
"prefixedRoutes",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"this",
"->",
"routes",
"as",
"$",
"name",
"=>",
"$",
"route",
")",
"{",
"$",
"prefixedRoutes",
"[",
"$",
"... | Adds a prefix to the name of all the routes within in the collection. | [
"Adds",
"a",
"prefix",
"to",
"the",
"name",
"of",
"all",
"the",
"routes",
"within",
"in",
"the",
"collection",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Routing/RouteCollection.php#L159-L171 |
206,759 | symfony/symfony | src/Symfony/Component/Routing/RouteCollection.php | RouteCollection.setHost | public function setHost($pattern, array $defaults = [], array $requirements = [])
{
foreach ($this->routes as $route) {
$route->setHost($pattern);
$route->addDefaults($defaults);
$route->addRequirements($requirements);
}
} | php | public function setHost($pattern, array $defaults = [], array $requirements = [])
{
foreach ($this->routes as $route) {
$route->setHost($pattern);
$route->addDefaults($defaults);
$route->addRequirements($requirements);
}
} | [
"public",
"function",
"setHost",
"(",
"$",
"pattern",
",",
"array",
"$",
"defaults",
"=",
"[",
"]",
",",
"array",
"$",
"requirements",
"=",
"[",
"]",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"routes",
"as",
"$",
"route",
")",
"{",
"$",
"route",... | Sets the host pattern on all routes.
@param string $pattern The pattern
@param array $defaults An array of default values
@param array $requirements An array of requirements | [
"Sets",
"the",
"host",
"pattern",
"on",
"all",
"routes",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Routing/RouteCollection.php#L180-L187 |
206,760 | symfony/symfony | src/Symfony/Component/Routing/RouteCollection.php | RouteCollection.addDefaults | public function addDefaults(array $defaults)
{
if ($defaults) {
foreach ($this->routes as $route) {
$route->addDefaults($defaults);
}
}
} | php | public function addDefaults(array $defaults)
{
if ($defaults) {
foreach ($this->routes as $route) {
$route->addDefaults($defaults);
}
}
} | [
"public",
"function",
"addDefaults",
"(",
"array",
"$",
"defaults",
")",
"{",
"if",
"(",
"$",
"defaults",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"routes",
"as",
"$",
"route",
")",
"{",
"$",
"route",
"->",
"addDefaults",
"(",
"$",
"defaults",
")... | Adds defaults to all routes.
An existing default value under the same name in a route will be overridden.
@param array $defaults An array of default values | [
"Adds",
"defaults",
"to",
"all",
"routes",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Routing/RouteCollection.php#L210-L217 |
206,761 | symfony/symfony | src/Symfony/Component/Routing/RouteCollection.php | RouteCollection.addRequirements | public function addRequirements(array $requirements)
{
if ($requirements) {
foreach ($this->routes as $route) {
$route->addRequirements($requirements);
}
}
} | php | public function addRequirements(array $requirements)
{
if ($requirements) {
foreach ($this->routes as $route) {
$route->addRequirements($requirements);
}
}
} | [
"public",
"function",
"addRequirements",
"(",
"array",
"$",
"requirements",
")",
"{",
"if",
"(",
"$",
"requirements",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"routes",
"as",
"$",
"route",
")",
"{",
"$",
"route",
"->",
"addRequirements",
"(",
"$",
... | Adds requirements to all routes.
An existing requirement under the same name in a route will be overridden.
@param array $requirements An array of requirements | [
"Adds",
"requirements",
"to",
"all",
"routes",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Routing/RouteCollection.php#L226-L233 |
206,762 | symfony/symfony | src/Symfony/Component/Routing/RouteCollection.php | RouteCollection.addOptions | public function addOptions(array $options)
{
if ($options) {
foreach ($this->routes as $route) {
$route->addOptions($options);
}
}
} | php | public function addOptions(array $options)
{
if ($options) {
foreach ($this->routes as $route) {
$route->addOptions($options);
}
}
} | [
"public",
"function",
"addOptions",
"(",
"array",
"$",
"options",
")",
"{",
"if",
"(",
"$",
"options",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"routes",
"as",
"$",
"route",
")",
"{",
"$",
"route",
"->",
"addOptions",
"(",
"$",
"options",
")",
... | Adds options to all routes.
An existing option value under the same name in a route will be overridden.
@param array $options An array of options | [
"Adds",
"options",
"to",
"all",
"routes",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Routing/RouteCollection.php#L242-L249 |
206,763 | symfony/symfony | src/Symfony/Component/Routing/RouteCollection.php | RouteCollection.addResource | public function addResource(ResourceInterface $resource)
{
$key = (string) $resource;
if (!isset($this->resources[$key])) {
$this->resources[$key] = $resource;
}
} | php | public function addResource(ResourceInterface $resource)
{
$key = (string) $resource;
if (!isset($this->resources[$key])) {
$this->resources[$key] = $resource;
}
} | [
"public",
"function",
"addResource",
"(",
"ResourceInterface",
"$",
"resource",
")",
"{",
"$",
"key",
"=",
"(",
"string",
")",
"$",
"resource",
";",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"resources",
"[",
"$",
"key",
"]",
")",
")",
"{",
... | Adds a resource for this collection. If the resource already exists
it is not added. | [
"Adds",
"a",
"resource",
"for",
"this",
"collection",
".",
"If",
"the",
"resource",
"already",
"exists",
"it",
"is",
"not",
"added",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Routing/RouteCollection.php#L289-L296 |
206,764 | symfony/symfony | src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php | FrameworkExtension.createPackageDefinition | private function createPackageDefinition($basePath, array $baseUrls, Reference $version)
{
if ($basePath && $baseUrls) {
throw new \LogicException('An asset package cannot have base URLs and base paths.');
}
$package = new ChildDefinition($baseUrls ? 'assets.url_package' : 'asse... | php | private function createPackageDefinition($basePath, array $baseUrls, Reference $version)
{
if ($basePath && $baseUrls) {
throw new \LogicException('An asset package cannot have base URLs and base paths.');
}
$package = new ChildDefinition($baseUrls ? 'assets.url_package' : 'asse... | [
"private",
"function",
"createPackageDefinition",
"(",
"$",
"basePath",
",",
"array",
"$",
"baseUrls",
",",
"Reference",
"$",
"version",
")",
"{",
"if",
"(",
"$",
"basePath",
"&&",
"$",
"baseUrls",
")",
"{",
"throw",
"new",
"\\",
"LogicException",
"(",
"'A... | Returns a definition for an asset package. | [
"Returns",
"a",
"definition",
"for",
"an",
"asset",
"package",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php#L1038-L1052 |
206,765 | symfony/symfony | src/Symfony/Component/Console/Application.php | Application.has | public function has($name)
{
$this->init();
return isset($this->commands[$name]) || ($this->commandLoader && $this->commandLoader->has($name) && $this->add($this->commandLoader->get($name)));
} | php | public function has($name)
{
$this->init();
return isset($this->commands[$name]) || ($this->commandLoader && $this->commandLoader->has($name) && $this->add($this->commandLoader->get($name)));
} | [
"public",
"function",
"has",
"(",
"$",
"name",
")",
"{",
"$",
"this",
"->",
"init",
"(",
")",
";",
"return",
"isset",
"(",
"$",
"this",
"->",
"commands",
"[",
"$",
"name",
"]",
")",
"||",
"(",
"$",
"this",
"->",
"commandLoader",
"&&",
"$",
"this"... | Returns true if the command exists, false otherwise.
@param string $name The command name or alias
@return bool true if the command exists, false otherwise | [
"Returns",
"true",
"if",
"the",
"command",
"exists",
"false",
"otherwise",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Console/Application.php#L533-L538 |
206,766 | symfony/symfony | src/Symfony/Component/Console/Application.php | Application.extractNamespace | public function extractNamespace($name, $limit = null)
{
$parts = explode(':', $name);
array_pop($parts);
return implode(':', null === $limit ? $parts : \array_slice($parts, 0, $limit));
} | php | public function extractNamespace($name, $limit = null)
{
$parts = explode(':', $name);
array_pop($parts);
return implode(':', null === $limit ? $parts : \array_slice($parts, 0, $limit));
} | [
"public",
"function",
"extractNamespace",
"(",
"$",
"name",
",",
"$",
"limit",
"=",
"null",
")",
"{",
"$",
"parts",
"=",
"explode",
"(",
"':'",
",",
"$",
"name",
")",
";",
"array_pop",
"(",
"$",
"parts",
")",
";",
"return",
"implode",
"(",
"':'",
"... | Returns the namespace part of the command name.
This method is not part of public API and should not be used directly.
@param string $name The full name of the command
@param string $limit The maximum number of parts of the namespace
@return string The namespace of the command | [
"Returns",
"the",
"namespace",
"part",
"of",
"the",
"command",
"name",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Console/Application.php#L1031-L1037 |
206,767 | symfony/symfony | src/Symfony/Component/Console/Application.php | Application.setDefaultCommand | public function setDefaultCommand($commandName, $isSingleCommand = false)
{
$this->defaultCommand = $commandName;
if ($isSingleCommand) {
// Ensure the command exist
$this->find($commandName);
$this->singleCommand = true;
}
return $this;
} | php | public function setDefaultCommand($commandName, $isSingleCommand = false)
{
$this->defaultCommand = $commandName;
if ($isSingleCommand) {
// Ensure the command exist
$this->find($commandName);
$this->singleCommand = true;
}
return $this;
} | [
"public",
"function",
"setDefaultCommand",
"(",
"$",
"commandName",
",",
"$",
"isSingleCommand",
"=",
"false",
")",
"{",
"$",
"this",
"->",
"defaultCommand",
"=",
"$",
"commandName",
";",
"if",
"(",
"$",
"isSingleCommand",
")",
"{",
"// Ensure the command exist"... | Sets the default Command name.
@param string $commandName The Command name
@param bool $isSingleCommand Set to true if there is only one command in this application
@return self | [
"Sets",
"the",
"default",
"Command",
"name",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Console/Application.php#L1098-L1110 |
206,768 | symfony/symfony | src/Symfony/Component/Serializer/Mapping/Factory/ClassResolverTrait.php | ClassResolverTrait.getClass | private function getClass($value)
{
if (\is_string($value)) {
if (!class_exists($value) && !interface_exists($value, false)) {
throw new InvalidArgumentException(sprintf('The class or interface "%s" does not exist.', $value));
}
return ltrim($value, '\\')... | php | private function getClass($value)
{
if (\is_string($value)) {
if (!class_exists($value) && !interface_exists($value, false)) {
throw new InvalidArgumentException(sprintf('The class or interface "%s" does not exist.', $value));
}
return ltrim($value, '\\')... | [
"private",
"function",
"getClass",
"(",
"$",
"value",
")",
"{",
"if",
"(",
"\\",
"is_string",
"(",
"$",
"value",
")",
")",
"{",
"if",
"(",
"!",
"class_exists",
"(",
"$",
"value",
")",
"&&",
"!",
"interface_exists",
"(",
"$",
"value",
",",
"false",
... | Gets a class name for a given class or instance.
@param mixed $value
@return string
@throws InvalidArgumentException If the class does not exists | [
"Gets",
"a",
"class",
"name",
"for",
"a",
"given",
"class",
"or",
"instance",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Serializer/Mapping/Factory/ClassResolverTrait.php#L34-L49 |
206,769 | symfony/symfony | src/Symfony/Component/Security/Core/Encoder/EncoderFactory.php | EncoderFactory.createEncoder | private function createEncoder(array $config)
{
if (isset($config['algorithm'])) {
$config = $this->getEncoderConfigFromAlgorithm($config);
}
if (!isset($config['class'])) {
throw new \InvalidArgumentException(sprintf('"class" must be set in %s.', json_encode($config)... | php | private function createEncoder(array $config)
{
if (isset($config['algorithm'])) {
$config = $this->getEncoderConfigFromAlgorithm($config);
}
if (!isset($config['class'])) {
throw new \InvalidArgumentException(sprintf('"class" must be set in %s.', json_encode($config)... | [
"private",
"function",
"createEncoder",
"(",
"array",
"$",
"config",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"config",
"[",
"'algorithm'",
"]",
")",
")",
"{",
"$",
"config",
"=",
"$",
"this",
"->",
"getEncoderConfigFromAlgorithm",
"(",
"$",
"config",
")"... | Creates the actual encoder instance.
@return PasswordEncoderInterface
@throws \InvalidArgumentException | [
"Creates",
"the",
"actual",
"encoder",
"instance",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Security/Core/Encoder/EncoderFactory.php#L68-L83 |
206,770 | symfony/symfony | src/Symfony/Component/Intl/Locale.php | Locale.getFallback | public static function getFallback($locale): ?string
{
if (\function_exists('locale_parse')) {
$localeSubTags = locale_parse($locale);
if (1 === \count($localeSubTags)) {
if (self::$defaultFallback === $localeSubTags['language']) {
return 'root';
... | php | public static function getFallback($locale): ?string
{
if (\function_exists('locale_parse')) {
$localeSubTags = locale_parse($locale);
if (1 === \count($localeSubTags)) {
if (self::$defaultFallback === $localeSubTags['language']) {
return 'root';
... | [
"public",
"static",
"function",
"getFallback",
"(",
"$",
"locale",
")",
":",
"?",
"string",
"{",
"if",
"(",
"\\",
"function_exists",
"(",
"'locale_parse'",
")",
")",
"{",
"$",
"localeSubTags",
"=",
"locale_parse",
"(",
"$",
"locale",
")",
";",
"if",
"(",... | Returns the fallback locale for a given locale.
For example, the fallback of "fr_FR" is "fr". The fallback of "fr" is
the default fallback locale configured with {@link setDefaultFallback()}.
The default fallback locale has no fallback.
@param string $locale The ICU locale code to find the fallback for
@return strin... | [
"Returns",
"the",
"fallback",
"locale",
"for",
"a",
"given",
"locale",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Intl/Locale.php#L68-L112 |
206,771 | symfony/symfony | src/Symfony/Component/EventDispatcher/Debug/TraceableEventDispatcher.php | TraceableEventDispatcher.beforeDispatch | protected function beforeDispatch(string $eventName, $event)
{
$this->preDispatch($eventName, $event instanceof Event ? $event : new LegacyEventProxy($event));
} | php | protected function beforeDispatch(string $eventName, $event)
{
$this->preDispatch($eventName, $event instanceof Event ? $event : new LegacyEventProxy($event));
} | [
"protected",
"function",
"beforeDispatch",
"(",
"string",
"$",
"eventName",
",",
"$",
"event",
")",
"{",
"$",
"this",
"->",
"preDispatch",
"(",
"$",
"eventName",
",",
"$",
"event",
"instanceof",
"Event",
"?",
"$",
"event",
":",
"new",
"LegacyEventProxy",
"... | Called before dispatching the event.
@param object $event | [
"Called",
"before",
"dispatching",
"the",
"event",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/EventDispatcher/Debug/TraceableEventDispatcher.php#L297-L300 |
206,772 | symfony/symfony | src/Symfony/Component/EventDispatcher/Debug/TraceableEventDispatcher.php | TraceableEventDispatcher.afterDispatch | protected function afterDispatch(string $eventName, $event)
{
$this->postDispatch($eventName, $event instanceof Event ? $event : new LegacyEventProxy($event));
} | php | protected function afterDispatch(string $eventName, $event)
{
$this->postDispatch($eventName, $event instanceof Event ? $event : new LegacyEventProxy($event));
} | [
"protected",
"function",
"afterDispatch",
"(",
"string",
"$",
"eventName",
",",
"$",
"event",
")",
"{",
"$",
"this",
"->",
"postDispatch",
"(",
"$",
"eventName",
",",
"$",
"event",
"instanceof",
"Event",
"?",
"$",
"event",
":",
"new",
"LegacyEventProxy",
"... | Called after dispatching the event.
@param object $event | [
"Called",
"after",
"dispatching",
"the",
"event",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/EventDispatcher/Debug/TraceableEventDispatcher.php#L307-L310 |
206,773 | symfony/symfony | src/Symfony/Component/Intl/Util/Version.php | Version.compare | public static function compare($version1, $version2, $operator, $precision = null)
{
$version1 = self::normalize($version1, $precision);
$version2 = self::normalize($version2, $precision);
return version_compare($version1, $version2, $operator);
} | php | public static function compare($version1, $version2, $operator, $precision = null)
{
$version1 = self::normalize($version1, $precision);
$version2 = self::normalize($version2, $precision);
return version_compare($version1, $version2, $operator);
} | [
"public",
"static",
"function",
"compare",
"(",
"$",
"version1",
",",
"$",
"version2",
",",
"$",
"operator",
",",
"$",
"precision",
"=",
"null",
")",
"{",
"$",
"version1",
"=",
"self",
"::",
"normalize",
"(",
"$",
"version1",
",",
"$",
"precision",
")"... | Compares two versions with an operator.
This method is identical to {@link version_compare()}, except that you
can pass the number of regarded version components in the last argument
$precision.
Examples:
Version::compare('1.2.3', '1.2.4', '==')
// => false
Version::compare('1.2.3', '1.2.4', '==', 2)
// => true
@p... | [
"Compares",
"two",
"versions",
"with",
"an",
"operator",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Intl/Util/Version.php#L46-L52 |
206,774 | symfony/symfony | src/Symfony/Component/HttpFoundation/Session/Storage/MockFileSessionStorage.php | MockFileSessionStorage.read | private function read()
{
$filePath = $this->getFilePath();
$this->data = is_readable($filePath) && is_file($filePath) ? unserialize(file_get_contents($filePath)) : [];
$this->loadSession();
} | php | private function read()
{
$filePath = $this->getFilePath();
$this->data = is_readable($filePath) && is_file($filePath) ? unserialize(file_get_contents($filePath)) : [];
$this->loadSession();
} | [
"private",
"function",
"read",
"(",
")",
"{",
"$",
"filePath",
"=",
"$",
"this",
"->",
"getFilePath",
"(",
")",
";",
"$",
"this",
"->",
"data",
"=",
"is_readable",
"(",
"$",
"filePath",
")",
"&&",
"is_file",
"(",
"$",
"filePath",
")",
"?",
"unseriali... | Reads session from storage and loads session. | [
"Reads",
"session",
"from",
"storage",
"and",
"loads",
"session",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/HttpFoundation/Session/Storage/MockFileSessionStorage.php#L145-L151 |
206,775 | symfony/symfony | src/Symfony/Component/Intl/ResourceBundle.php | ResourceBundle.readEntry | final protected static function readEntry(array $indices, string $locale = null, bool $fallback = true)
{
if (null === self::$entryReader) {
self::$entryReader = new BundleEntryReader(new BufferedBundleReader(
new JsonBundleReader(),
Intl::BUFFER_SIZE
... | php | final protected static function readEntry(array $indices, string $locale = null, bool $fallback = true)
{
if (null === self::$entryReader) {
self::$entryReader = new BundleEntryReader(new BufferedBundleReader(
new JsonBundleReader(),
Intl::BUFFER_SIZE
... | [
"final",
"protected",
"static",
"function",
"readEntry",
"(",
"array",
"$",
"indices",
",",
"string",
"$",
"locale",
"=",
"null",
",",
"bool",
"$",
"fallback",
"=",
"true",
")",
"{",
"if",
"(",
"null",
"===",
"self",
"::",
"$",
"entryReader",
")",
"{",... | Reads an entry from a resource bundle.
@see BundleEntryReaderInterface::readEntry()
@param string[] $indices The indices to read from the bundle
@param string $locale The locale to read
@param bool $fallback Whether to merge the value with the value from
the fallback locale (e.g. "en" for "en_GB").
Only appl... | [
"Reads",
"an",
"entry",
"from",
"a",
"resource",
"bundle",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Intl/ResourceBundle.php#L46-L59 |
206,776 | symfony/symfony | src/Symfony/Component/Config/Definition/Builder/ArrayNodeDefinition.php | ArrayNodeDefinition.prototype | public function prototype($type)
{
return $this->prototype = $this->getNodeBuilder()->node(null, $type)->setParent($this);
} | php | public function prototype($type)
{
return $this->prototype = $this->getNodeBuilder()->node(null, $type)->setParent($this);
} | [
"public",
"function",
"prototype",
"(",
"$",
"type",
")",
"{",
"return",
"$",
"this",
"->",
"prototype",
"=",
"$",
"this",
"->",
"getNodeBuilder",
"(",
")",
"->",
"node",
"(",
"null",
",",
"$",
"type",
")",
"->",
"setParent",
"(",
"$",
"this",
")",
... | Sets a prototype for child nodes.
@param string $type The type of node
@return NodeDefinition | [
"Sets",
"a",
"prototype",
"for",
"child",
"nodes",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Config/Definition/Builder/ArrayNodeDefinition.php#L73-L76 |
206,777 | symfony/symfony | src/Symfony/Component/Config/Definition/Builder/ArrayNodeDefinition.php | ArrayNodeDefinition.fixXmlConfig | public function fixXmlConfig($singular, $plural = null)
{
$this->normalization()->remap($singular, $plural);
return $this;
} | php | public function fixXmlConfig($singular, $plural = null)
{
$this->normalization()->remap($singular, $plural);
return $this;
} | [
"public",
"function",
"fixXmlConfig",
"(",
"$",
"singular",
",",
"$",
"plural",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"normalization",
"(",
")",
"->",
"remap",
"(",
"$",
"singular",
",",
"$",
"plural",
")",
";",
"return",
"$",
"this",
";",
"}"
] | Sets a normalization rule for XML configurations.
@param string $singular The key to remap
@param string $plural The plural of the key for irregular plurals
@return $this | [
"Sets",
"a",
"normalization",
"rule",
"for",
"XML",
"configurations",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Config/Definition/Builder/ArrayNodeDefinition.php#L202-L207 |
206,778 | symfony/symfony | src/Symfony/Component/Config/Definition/Builder/ArrayNodeDefinition.php | ArrayNodeDefinition.ignoreExtraKeys | public function ignoreExtraKeys($remove = true)
{
$this->ignoreExtraKeys = true;
$this->removeExtraKeys = $remove;
return $this;
} | php | public function ignoreExtraKeys($remove = true)
{
$this->ignoreExtraKeys = true;
$this->removeExtraKeys = $remove;
return $this;
} | [
"public",
"function",
"ignoreExtraKeys",
"(",
"$",
"remove",
"=",
"true",
")",
"{",
"$",
"this",
"->",
"ignoreExtraKeys",
"=",
"true",
";",
"$",
"this",
"->",
"removeExtraKeys",
"=",
"$",
"remove",
";",
"return",
"$",
"this",
";",
"}"
] | Allows extra config keys to be specified under an array without
throwing an exception.
Those config values are ignored and removed from the resulting
array. This should be used only in special cases where you want
to send an entire configuration array through a special tree that
processes only part of the array.
@par... | [
"Allows",
"extra",
"config",
"keys",
"to",
"be",
"specified",
"under",
"an",
"array",
"without",
"throwing",
"an",
"exception",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Config/Definition/Builder/ArrayNodeDefinition.php#L344-L350 |
206,779 | symfony/symfony | src/Symfony/Component/Config/Definition/Builder/ArrayNodeDefinition.php | ArrayNodeDefinition.getNodeBuilder | protected function getNodeBuilder()
{
if (null === $this->nodeBuilder) {
$this->nodeBuilder = new NodeBuilder();
}
return $this->nodeBuilder->setParent($this);
} | php | protected function getNodeBuilder()
{
if (null === $this->nodeBuilder) {
$this->nodeBuilder = new NodeBuilder();
}
return $this->nodeBuilder->setParent($this);
} | [
"protected",
"function",
"getNodeBuilder",
"(",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"this",
"->",
"nodeBuilder",
")",
"{",
"$",
"this",
"->",
"nodeBuilder",
"=",
"new",
"NodeBuilder",
"(",
")",
";",
"}",
"return",
"$",
"this",
"->",
"nodeBuilder",
... | Returns a node builder to be used to add children and prototype.
@return NodeBuilder The node builder | [
"Returns",
"a",
"node",
"builder",
"to",
"be",
"used",
"to",
"add",
"children",
"and",
"prototype",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Config/Definition/Builder/ArrayNodeDefinition.php#L381-L388 |
206,780 | symfony/symfony | src/Symfony/Component/Config/Definition/Builder/ArrayNodeDefinition.php | ArrayNodeDefinition.validateConcreteNode | protected function validateConcreteNode(ArrayNode $node)
{
$path = $node->getPath();
if (null !== $this->key) {
throw new InvalidDefinitionException(sprintf('->useAttributeAsKey() is not applicable to concrete nodes at path "%s"', $path));
}
if (false === $this->allowEm... | php | protected function validateConcreteNode(ArrayNode $node)
{
$path = $node->getPath();
if (null !== $this->key) {
throw new InvalidDefinitionException(sprintf('->useAttributeAsKey() is not applicable to concrete nodes at path "%s"', $path));
}
if (false === $this->allowEm... | [
"protected",
"function",
"validateConcreteNode",
"(",
"ArrayNode",
"$",
"node",
")",
"{",
"$",
"path",
"=",
"$",
"node",
"->",
"getPath",
"(",
")",
";",
"if",
"(",
"null",
"!==",
"$",
"this",
"->",
"key",
")",
"{",
"throw",
"new",
"InvalidDefinitionExcep... | Validate the configuration of a concrete node.
@throws InvalidDefinitionException | [
"Validate",
"the",
"configuration",
"of",
"a",
"concrete",
"node",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Config/Definition/Builder/ArrayNodeDefinition.php#L466-L489 |
206,781 | symfony/symfony | src/Symfony/Component/Translation/Extractor/PhpExtractor.php | PhpExtractor.seekToNextRelevantToken | private function seekToNextRelevantToken(\Iterator $tokenIterator)
{
for (; $tokenIterator->valid(); $tokenIterator->next()) {
$t = $tokenIterator->current();
if (T_WHITESPACE !== $t[0]) {
break;
}
}
} | php | private function seekToNextRelevantToken(\Iterator $tokenIterator)
{
for (; $tokenIterator->valid(); $tokenIterator->next()) {
$t = $tokenIterator->current();
if (T_WHITESPACE !== $t[0]) {
break;
}
}
} | [
"private",
"function",
"seekToNextRelevantToken",
"(",
"\\",
"Iterator",
"$",
"tokenIterator",
")",
"{",
"for",
"(",
";",
"$",
"tokenIterator",
"->",
"valid",
"(",
")",
";",
"$",
"tokenIterator",
"->",
"next",
"(",
")",
")",
"{",
"$",
"t",
"=",
"$",
"t... | Seeks to a non-whitespace token. | [
"Seeks",
"to",
"a",
"non",
"-",
"whitespace",
"token",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Translation/Extractor/PhpExtractor.php#L117-L125 |
206,782 | symfony/symfony | src/Symfony/Component/Translation/Extractor/PhpExtractor.php | PhpExtractor.getValue | private function getValue(\Iterator $tokenIterator)
{
$message = '';
$docToken = '';
$docPart = '';
for (; $tokenIterator->valid(); $tokenIterator->next()) {
$t = $tokenIterator->current();
if ('.' === $t) {
// Concatenate with next token
... | php | private function getValue(\Iterator $tokenIterator)
{
$message = '';
$docToken = '';
$docPart = '';
for (; $tokenIterator->valid(); $tokenIterator->next()) {
$t = $tokenIterator->current();
if ('.' === $t) {
// Concatenate with next token
... | [
"private",
"function",
"getValue",
"(",
"\\",
"Iterator",
"$",
"tokenIterator",
")",
"{",
"$",
"message",
"=",
"''",
";",
"$",
"docToken",
"=",
"''",
";",
"$",
"docPart",
"=",
"''",
";",
"for",
"(",
";",
"$",
"tokenIterator",
"->",
"valid",
"(",
")",... | Extracts the message from the iterator while the tokens
match allowed message tokens. | [
"Extracts",
"the",
"message",
"from",
"the",
"iterator",
"while",
"the",
"tokens",
"match",
"allowed",
"message",
"tokens",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Translation/Extractor/PhpExtractor.php#L152-L193 |
206,783 | symfony/symfony | src/Symfony/Component/Translation/Extractor/PhpExtractor.php | PhpExtractor.parseTokens | protected function parseTokens($tokens, MessageCatalogue $catalog)
{
$tokenIterator = new \ArrayIterator($tokens);
for ($key = 0; $key < $tokenIterator->count(); ++$key) {
foreach ($this->sequences as $sequence) {
$message = '';
$domain = 'messages';
... | php | protected function parseTokens($tokens, MessageCatalogue $catalog)
{
$tokenIterator = new \ArrayIterator($tokens);
for ($key = 0; $key < $tokenIterator->count(); ++$key) {
foreach ($this->sequences as $sequence) {
$message = '';
$domain = 'messages';
... | [
"protected",
"function",
"parseTokens",
"(",
"$",
"tokens",
",",
"MessageCatalogue",
"$",
"catalog",
")",
"{",
"$",
"tokenIterator",
"=",
"new",
"\\",
"ArrayIterator",
"(",
"$",
"tokens",
")",
";",
"for",
"(",
"$",
"key",
"=",
"0",
";",
"$",
"key",
"<"... | Extracts trans message from PHP tokens.
@param array $tokens
@param MessageCatalogue $catalog | [
"Extracts",
"trans",
"message",
"from",
"PHP",
"tokens",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Translation/Extractor/PhpExtractor.php#L201-L243 |
206,784 | symfony/symfony | src/Symfony/Component/HttpFoundation/FileBag.php | FileBag.convertFileInformation | protected function convertFileInformation($file)
{
if ($file instanceof UploadedFile) {
return $file;
}
$file = $this->fixPhpFilesArray($file);
if (\is_array($file)) {
$keys = array_keys($file);
sort($keys);
if ($keys == self::$fileKe... | php | protected function convertFileInformation($file)
{
if ($file instanceof UploadedFile) {
return $file;
}
$file = $this->fixPhpFilesArray($file);
if (\is_array($file)) {
$keys = array_keys($file);
sort($keys);
if ($keys == self::$fileKe... | [
"protected",
"function",
"convertFileInformation",
"(",
"$",
"file",
")",
"{",
"if",
"(",
"$",
"file",
"instanceof",
"UploadedFile",
")",
"{",
"return",
"$",
"file",
";",
"}",
"$",
"file",
"=",
"$",
"this",
"->",
"fixPhpFilesArray",
"(",
"$",
"file",
")"... | Converts uploaded files to UploadedFile instances.
@param array|UploadedFile $file A (multi-dimensional) array of uploaded file information
@return UploadedFile[]|UploadedFile|null A (multi-dimensional) array of UploadedFile instances | [
"Converts",
"uploaded",
"files",
"to",
"UploadedFile",
"instances",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/HttpFoundation/FileBag.php#L72-L98 |
206,785 | symfony/symfony | src/Symfony/Component/CssSelector/Node/Specificity.php | Specificity.compareTo | public function compareTo(self $specificity)
{
if ($this->a !== $specificity->a) {
return $this->a > $specificity->a ? 1 : -1;
}
if ($this->b !== $specificity->b) {
return $this->b > $specificity->b ? 1 : -1;
}
if ($this->c !== $specificity->c) {
... | php | public function compareTo(self $specificity)
{
if ($this->a !== $specificity->a) {
return $this->a > $specificity->a ? 1 : -1;
}
if ($this->b !== $specificity->b) {
return $this->b > $specificity->b ? 1 : -1;
}
if ($this->c !== $specificity->c) {
... | [
"public",
"function",
"compareTo",
"(",
"self",
"$",
"specificity",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"a",
"!==",
"$",
"specificity",
"->",
"a",
")",
"{",
"return",
"$",
"this",
"->",
"a",
">",
"$",
"specificity",
"->",
"a",
"?",
"1",
":",
... | Returns -1 if the object specificity is lower than the argument,
0 if they are equal, and 1 if the argument is lower.
@return int | [
"Returns",
"-",
"1",
"if",
"the",
"object",
"specificity",
"is",
"lower",
"than",
"the",
"argument",
"0",
"if",
"they",
"are",
"equal",
"and",
"1",
"if",
"the",
"argument",
"is",
"lower",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/CssSelector/Node/Specificity.php#L59-L74 |
206,786 | symfony/symfony | src/Symfony/Component/Form/Extension/Validator/ViolationMapper/ViolationPath.php | ViolationPath.mapsForm | public function mapsForm($index)
{
if (!isset($this->mapsForm[$index])) {
throw new OutOfBoundsException(sprintf('The index %s is not within the violation path', $index));
}
return $this->mapsForm[$index];
} | php | public function mapsForm($index)
{
if (!isset($this->mapsForm[$index])) {
throw new OutOfBoundsException(sprintf('The index %s is not within the violation path', $index));
}
return $this->mapsForm[$index];
} | [
"public",
"function",
"mapsForm",
"(",
"$",
"index",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"mapsForm",
"[",
"$",
"index",
"]",
")",
")",
"{",
"throw",
"new",
"OutOfBoundsException",
"(",
"sprintf",
"(",
"'The index %s is not within the... | Returns whether an element maps directly to a form.
Consider the following violation path:
children[address].children[office].data.street
In this example, "address" and "office" map to forms, while
"street does not.
@param int $index The element index
@return bool Whether the element maps to a form
@throws OutOfB... | [
"Returns",
"whether",
"an",
"element",
"maps",
"directly",
"to",
"a",
"form",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Form/Extension/Validator/ViolationMapper/ViolationPath.php#L212-L219 |
206,787 | symfony/symfony | src/Symfony/Component/Form/Extension/Validator/ViolationMapper/ViolationPath.php | ViolationPath.buildString | private function buildString()
{
$this->pathAsString = '';
$data = false;
foreach ($this->elements as $index => $element) {
if ($this->mapsForm[$index]) {
$this->pathAsString .= ".children[$element]";
} elseif (!$data) {
$this->pathAsS... | php | private function buildString()
{
$this->pathAsString = '';
$data = false;
foreach ($this->elements as $index => $element) {
if ($this->mapsForm[$index]) {
$this->pathAsString .= ".children[$element]";
} elseif (!$data) {
$this->pathAsS... | [
"private",
"function",
"buildString",
"(",
")",
"{",
"$",
"this",
"->",
"pathAsString",
"=",
"''",
";",
"$",
"data",
"=",
"false",
";",
"foreach",
"(",
"$",
"this",
"->",
"elements",
"as",
"$",
"index",
"=>",
"$",
"element",
")",
"{",
"if",
"(",
"$... | Builds the string representation from the elements. | [
"Builds",
"the",
"string",
"representation",
"from",
"the",
"elements",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Form/Extension/Validator/ViolationMapper/ViolationPath.php#L234-L254 |
206,788 | symfony/symfony | src/Symfony/Component/Form/Extension/Core/DataTransformer/DateTimeToRfc3339Transformer.php | DateTimeToRfc3339Transformer.reverseTransform | public function reverseTransform($rfc3339)
{
if (!\is_string($rfc3339)) {
throw new TransformationFailedException('Expected a string.');
}
if ('' === $rfc3339) {
return;
}
if (!preg_match('/^(\d{4})-(\d{2})-(\d{2})T\d{2}:\d{2}(?::\d{2})?(?:\.\d+)?(?:... | php | public function reverseTransform($rfc3339)
{
if (!\is_string($rfc3339)) {
throw new TransformationFailedException('Expected a string.');
}
if ('' === $rfc3339) {
return;
}
if (!preg_match('/^(\d{4})-(\d{2})-(\d{2})T\d{2}:\d{2}(?::\d{2})?(?:\.\d+)?(?:... | [
"public",
"function",
"reverseTransform",
"(",
"$",
"rfc3339",
")",
"{",
"if",
"(",
"!",
"\\",
"is_string",
"(",
"$",
"rfc3339",
")",
")",
"{",
"throw",
"new",
"TransformationFailedException",
"(",
"'Expected a string.'",
")",
";",
"}",
"if",
"(",
"''",
"=... | Transforms a formatted string following RFC 3339 into a normalized date.
@param string $rfc3339 Formatted string
@return \DateTime Normalized date
@throws TransformationFailedException If the given value is not a string,
if the value could not be transformed | [
"Transforms",
"a",
"formatted",
"string",
"following",
"RFC",
"3339",
"into",
"a",
"normalized",
"date",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Form/Extension/Core/DataTransformer/DateTimeToRfc3339Transformer.php#L61-L90 |
206,789 | symfony/symfony | src/Symfony/Component/Cache/LockRegistry.php | LockRegistry.setFiles | public static function setFiles(array $files): array
{
$previousFiles = self::$files;
self::$files = $files;
foreach (self::$openedFiles as $file) {
if ($file) {
flock($file, LOCK_UN);
fclose($file);
}
}
self::$openedFi... | php | public static function setFiles(array $files): array
{
$previousFiles = self::$files;
self::$files = $files;
foreach (self::$openedFiles as $file) {
if ($file) {
flock($file, LOCK_UN);
fclose($file);
}
}
self::$openedFi... | [
"public",
"static",
"function",
"setFiles",
"(",
"array",
"$",
"files",
")",
":",
"array",
"{",
"$",
"previousFiles",
"=",
"self",
"::",
"$",
"files",
";",
"self",
"::",
"$",
"files",
"=",
"$",
"files",
";",
"foreach",
"(",
"self",
"::",
"$",
"opened... | Defines a set of existing files that will be used as keys to acquire locks.
@return array The previously defined set of files | [
"Defines",
"a",
"set",
"of",
"existing",
"files",
"that",
"will",
"be",
"used",
"as",
"keys",
"to",
"acquire",
"locks",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Cache/LockRegistry.php#L66-L80 |
206,790 | symfony/symfony | src/Symfony/Component/DependencyInjection/Loader/Configurator/AbstractConfigurator.php | AbstractConfigurator.processValue | public static function processValue($value, $allowServices = false)
{
if (\is_array($value)) {
foreach ($value as $k => $v) {
$value[$k] = static::processValue($v, $allowServices);
}
return $value;
}
if ($value instanceof ReferenceConfigu... | php | public static function processValue($value, $allowServices = false)
{
if (\is_array($value)) {
foreach ($value as $k => $v) {
$value[$k] = static::processValue($v, $allowServices);
}
return $value;
}
if ($value instanceof ReferenceConfigu... | [
"public",
"static",
"function",
"processValue",
"(",
"$",
"value",
",",
"$",
"allowServices",
"=",
"false",
")",
"{",
"if",
"(",
"\\",
"is_array",
"(",
"$",
"value",
")",
")",
"{",
"foreach",
"(",
"$",
"value",
"as",
"$",
"k",
"=>",
"$",
"v",
")",
... | Checks that a value is valid, optionally replacing Definition and Reference configurators by their configure value.
@param mixed $value
@param bool $allowServices whether Definition and Reference are allowed; by default, only scalars and arrays are
@return mixed the value, optionally cast to a Definition/Reference | [
"Checks",
"that",
"a",
"value",
"is",
"valid",
"optionally",
"replacing",
"Definition",
"and",
"Reference",
"configurators",
"by",
"their",
"configure",
"value",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/DependencyInjection/Loader/Configurator/AbstractConfigurator.php#L45-L86 |
206,791 | symfony/symfony | src/Symfony/Component/Security/Http/RememberMe/AbstractRememberMeServices.php | AbstractRememberMeServices.autoLogin | final public function autoLogin(Request $request): ?TokenInterface
{
if (null === $cookie = $request->cookies->get($this->options['name'])) {
return null;
}
if (null !== $this->logger) {
$this->logger->debug('Remember-me cookie detected.');
}
$cookie... | php | final public function autoLogin(Request $request): ?TokenInterface
{
if (null === $cookie = $request->cookies->get($this->options['name'])) {
return null;
}
if (null !== $this->logger) {
$this->logger->debug('Remember-me cookie detected.');
}
$cookie... | [
"final",
"public",
"function",
"autoLogin",
"(",
"Request",
"$",
"request",
")",
":",
"?",
"TokenInterface",
"{",
"if",
"(",
"null",
"===",
"$",
"cookie",
"=",
"$",
"request",
"->",
"cookies",
"->",
"get",
"(",
"$",
"this",
"->",
"options",
"[",
"'name... | Implementation of RememberMeServicesInterface. Detects whether a remember-me
cookie was set, decodes it, and hands it to subclasses for further processing.
@throws CookieTheftException
@throws \RuntimeException | [
"Implementation",
"of",
"RememberMeServicesInterface",
".",
"Detects",
"whether",
"a",
"remember",
"-",
"me",
"cookie",
"was",
"set",
"decodes",
"it",
"and",
"hands",
"it",
"to",
"subclasses",
"for",
"further",
"processing",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Security/Http/RememberMe/AbstractRememberMeServices.php#L94-L147 |
206,792 | symfony/symfony | src/Symfony/Component/Security/Http/RememberMe/AbstractRememberMeServices.php | AbstractRememberMeServices.logout | public function logout(Request $request, Response $response, TokenInterface $token)
{
$this->cancelCookie($request);
} | php | public function logout(Request $request, Response $response, TokenInterface $token)
{
$this->cancelCookie($request);
} | [
"public",
"function",
"logout",
"(",
"Request",
"$",
"request",
",",
"Response",
"$",
"response",
",",
"TokenInterface",
"$",
"token",
")",
"{",
"$",
"this",
"->",
"cancelCookie",
"(",
"$",
"request",
")",
";",
"}"
] | Implementation for LogoutHandlerInterface. Deletes the cookie. | [
"Implementation",
"for",
"LogoutHandlerInterface",
".",
"Deletes",
"the",
"cookie",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Security/Http/RememberMe/AbstractRememberMeServices.php#L152-L155 |
206,793 | symfony/symfony | src/Symfony/Component/Security/Http/RememberMe/AbstractRememberMeServices.php | AbstractRememberMeServices.loginFail | final public function loginFail(Request $request, \Exception $exception = null)
{
$this->cancelCookie($request);
$this->onLoginFail($request, $exception);
} | php | final public function loginFail(Request $request, \Exception $exception = null)
{
$this->cancelCookie($request);
$this->onLoginFail($request, $exception);
} | [
"final",
"public",
"function",
"loginFail",
"(",
"Request",
"$",
"request",
",",
"\\",
"Exception",
"$",
"exception",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"cancelCookie",
"(",
"$",
"request",
")",
";",
"$",
"this",
"->",
"onLoginFail",
"(",
"$",
"... | Implementation for RememberMeServicesInterface. Deletes the cookie when
an attempted authentication fails. | [
"Implementation",
"for",
"RememberMeServicesInterface",
".",
"Deletes",
"the",
"cookie",
"when",
"an",
"attempted",
"authentication",
"fails",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Security/Http/RememberMe/AbstractRememberMeServices.php#L161-L165 |
206,794 | symfony/symfony | src/Symfony/Component/Security/Http/RememberMe/AbstractRememberMeServices.php | AbstractRememberMeServices.loginSuccess | final public function loginSuccess(Request $request, Response $response, TokenInterface $token)
{
// Make sure any old remember-me cookies are cancelled
$this->cancelCookie($request);
if (!$token->getUser() instanceof UserInterface) {
if (null !== $this->logger) {
... | php | final public function loginSuccess(Request $request, Response $response, TokenInterface $token)
{
// Make sure any old remember-me cookies are cancelled
$this->cancelCookie($request);
if (!$token->getUser() instanceof UserInterface) {
if (null !== $this->logger) {
... | [
"final",
"public",
"function",
"loginSuccess",
"(",
"Request",
"$",
"request",
",",
"Response",
"$",
"response",
",",
"TokenInterface",
"$",
"token",
")",
"{",
"// Make sure any old remember-me cookies are cancelled",
"$",
"this",
"->",
"cancelCookie",
"(",
"$",
"re... | Implementation for RememberMeServicesInterface. This is called when an
authentication is successful. | [
"Implementation",
"for",
"RememberMeServicesInterface",
".",
"This",
"is",
"called",
"when",
"an",
"authentication",
"is",
"successful",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Security/Http/RememberMe/AbstractRememberMeServices.php#L171-L203 |
206,795 | symfony/symfony | src/Symfony/Component/Security/Http/RememberMe/AbstractRememberMeServices.php | AbstractRememberMeServices.encodeCookie | protected function encodeCookie(array $cookieParts)
{
foreach ($cookieParts as $cookiePart) {
if (false !== strpos($cookiePart, self::COOKIE_DELIMITER)) {
throw new \InvalidArgumentException(sprintf('$cookieParts should not contain the cookie delimiter "%s"', self::COOKIE_DELIMIT... | php | protected function encodeCookie(array $cookieParts)
{
foreach ($cookieParts as $cookiePart) {
if (false !== strpos($cookiePart, self::COOKIE_DELIMITER)) {
throw new \InvalidArgumentException(sprintf('$cookieParts should not contain the cookie delimiter "%s"', self::COOKIE_DELIMIT... | [
"protected",
"function",
"encodeCookie",
"(",
"array",
"$",
"cookieParts",
")",
"{",
"foreach",
"(",
"$",
"cookieParts",
"as",
"$",
"cookiePart",
")",
"{",
"if",
"(",
"false",
"!==",
"strpos",
"(",
"$",
"cookiePart",
",",
"self",
"::",
"COOKIE_DELIMITER",
... | Encodes the cookie parts.
@return string
@throws \InvalidArgumentException When $cookieParts contain the cookie delimiter. Extending class should either remove or escape it. | [
"Encodes",
"the",
"cookie",
"parts",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Security/Http/RememberMe/AbstractRememberMeServices.php#L254-L263 |
206,796 | symfony/symfony | src/Symfony/Component/Security/Http/RememberMe/AbstractRememberMeServices.php | AbstractRememberMeServices.cancelCookie | protected function cancelCookie(Request $request)
{
if (null !== $this->logger) {
$this->logger->debug('Clearing remember-me cookie.', ['name' => $this->options['name']]);
}
$request->attributes->set(self::COOKIE_ATTR_NAME, new Cookie($this->options['name'], null, 1, $this->opti... | php | protected function cancelCookie(Request $request)
{
if (null !== $this->logger) {
$this->logger->debug('Clearing remember-me cookie.', ['name' => $this->options['name']]);
}
$request->attributes->set(self::COOKIE_ATTR_NAME, new Cookie($this->options['name'], null, 1, $this->opti... | [
"protected",
"function",
"cancelCookie",
"(",
"Request",
"$",
"request",
")",
"{",
"if",
"(",
"null",
"!==",
"$",
"this",
"->",
"logger",
")",
"{",
"$",
"this",
"->",
"logger",
"->",
"debug",
"(",
"'Clearing remember-me cookie.'",
",",
"[",
"'name'",
"=>",... | Deletes the remember-me cookie. | [
"Deletes",
"the",
"remember",
"-",
"me",
"cookie",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Security/Http/RememberMe/AbstractRememberMeServices.php#L268-L275 |
206,797 | symfony/symfony | src/Symfony/Bridge/ProxyManager/LazyProxy/PhpDumper/ProxyDumper.php | ProxyDumper.getProxyClassName | private function getProxyClassName(Definition $definition): string
{
$class = $this->proxyGenerator->getProxifiedClass($definition);
return preg_replace('/^.*\\\\/', '', $class).'_'.$this->getIdentifierSuffix($definition);
} | php | private function getProxyClassName(Definition $definition): string
{
$class = $this->proxyGenerator->getProxifiedClass($definition);
return preg_replace('/^.*\\\\/', '', $class).'_'.$this->getIdentifierSuffix($definition);
} | [
"private",
"function",
"getProxyClassName",
"(",
"Definition",
"$",
"definition",
")",
":",
"string",
"{",
"$",
"class",
"=",
"$",
"this",
"->",
"proxyGenerator",
"->",
"getProxifiedClass",
"(",
"$",
"definition",
")",
";",
"return",
"preg_replace",
"(",
"'/^.... | Produces the proxy class name for the given definition. | [
"Produces",
"the",
"proxy",
"class",
"name",
"for",
"the",
"given",
"definition",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Bridge/ProxyManager/LazyProxy/PhpDumper/ProxyDumper.php#L112-L117 |
206,798 | symfony/symfony | src/Symfony/Component/HttpFoundation/File/MimeType/ExtensionGuesser.php | ExtensionGuesser.guess | public function guess($mimeType)
{
foreach ($this->guessers as $guesser) {
if (null !== $extension = $guesser->guess($mimeType)) {
return $extension;
}
}
} | php | public function guess($mimeType)
{
foreach ($this->guessers as $guesser) {
if (null !== $extension = $guesser->guess($mimeType)) {
return $extension;
}
}
} | [
"public",
"function",
"guess",
"(",
"$",
"mimeType",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"guessers",
"as",
"$",
"guesser",
")",
"{",
"if",
"(",
"null",
"!==",
"$",
"extension",
"=",
"$",
"guesser",
"->",
"guess",
"(",
"$",
"mimeType",
")",
... | Tries to guess the extension.
The mime type is passed to each registered mime type guesser in reverse order
of their registration (last registered is queried first). Once a guesser
returns a value that is not NULL, this method terminates and returns the
value.
@param string $mimeType The mime type
@return string The... | [
"Tries",
"to",
"guess",
"the",
"extension",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/HttpFoundation/File/MimeType/ExtensionGuesser.php#L92-L99 |
206,799 | symfony/symfony | src/Symfony/Component/HttpFoundation/HeaderUtils.php | HeaderUtils.split | public static function split(string $header, string $separators): array
{
$quotedSeparators = preg_quote($separators, '/');
preg_match_all('
/
(?!\s)
(?:
# quoted-string
"(?:[^"\\\\]|\\\\.)*(?:"|\\\\|$)
... | php | public static function split(string $header, string $separators): array
{
$quotedSeparators = preg_quote($separators, '/');
preg_match_all('
/
(?!\s)
(?:
# quoted-string
"(?:[^"\\\\]|\\\\.)*(?:"|\\\\|$)
... | [
"public",
"static",
"function",
"split",
"(",
"string",
"$",
"header",
",",
"string",
"$",
"separators",
")",
":",
"array",
"{",
"$",
"quotedSeparators",
"=",
"preg_quote",
"(",
"$",
"separators",
",",
"'/'",
")",
";",
"preg_match_all",
"(",
"'\n ... | Splits an HTTP header by one or more separators.
Example:
HeaderUtils::split("da, en-gb;q=0.8", ",;")
// => ['da'], ['en-gb', 'q=0.8']]
@param string $header HTTP header value
@param string $separators List of characters to split on, ordered by
precedence, e.g. ",", ";=", or ",;="
@return array Nested array wit... | [
"Splits",
"an",
"HTTP",
"header",
"by",
"one",
"or",
"more",
"separators",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/HttpFoundation/HeaderUtils.php#L46-L69 |
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.