private function FormFieldRegistry::getSegments in Zircon Profile 8.0
Same name and namespace in other branches
- 8 vendor/symfony/dom-crawler/FormFieldRegistry.php \Symfony\Component\DomCrawler\FormFieldRegistry::getSegments()
Splits a field name into segments as a web browser would do.
<code> getSegments('base[foo][3][]') = array('base', 'foo, '3', ''); </code>
Parameters
string $name The name of the field:
Return value
string[] The list of segments
Throws
\InvalidArgumentException when the name is malformed
3 calls to FormFieldRegistry::getSegments()
- FormFieldRegistry::add in vendor/
symfony/ dom-crawler/ FormFieldRegistry.php - Adds a field to the registry.
- FormFieldRegistry::get in vendor/
symfony/ dom-crawler/ FormFieldRegistry.php - Returns the value of the field and its children.
- FormFieldRegistry::remove in vendor/
symfony/ dom-crawler/ FormFieldRegistry.php - Removes a field and its children from the registry.
File
- vendor/
symfony/ dom-crawler/ FormFieldRegistry.php, line 205
Class
- FormFieldRegistry
- This is an internal class that must not be used directly.
Namespace
Symfony\Component\DomCrawlerCode
private function getSegments($name) {
if (preg_match('/^(?P<base>[^[]+)(?P<extra>(\\[.*)|$)/', $name, $m)) {
$segments = array(
$m['base'],
);
while (!empty($m['extra'])) {
if (preg_match('/^\\[(?P<segment>.*?)\\](?P<extra>.*)$/', $m['extra'], $m)) {
$segments[] = $m['segment'];
}
else {
throw new \InvalidArgumentException(sprintf('Malformed field path "%s"', $name));
}
}
return $segments;
}
throw new \InvalidArgumentException(sprintf('Malformed field path "%s"', $name));
}