function parse_types($text)
{
if (!preg_match('#^\\(([^)]+)\\)#', ltrim($text), $matches)) {
return 'none';
}
$types = explode('|', strtolower($matches[1]));
$return = array();
foreach ($types as $type) {
foreach (array(':' => 'children', '>' => 'subtype', '=' => 'default') as $operator => $meaning) {
if (false !== strpos($type, $operator)) {
$item = explode($operator, $type, 2);
$return[] = array('type' => $item[0], $meaning => $item[1]);
continue 2;
}
}
$return[] = compact('type');
}
return $return;
}