protected function parseAnnotations(ClassType $reflection)
{
foreach ($reflection->getAnnotations() as $annotation => $values) {
if ($annotation === 'property') {
$isReadonly = false;
} elseif ($annotation === 'property-read') {
$isReadonly = true;
} else {
continue;
}
foreach ($values as $value) {
$splitted = preg_split('#\\s+#', $value, 3);
if (count($splitted) < 2 || $splitted[1][0] !== '$') {
throw new InvalidArgumentException("Annotation syntax error '{$value}'.");
}
$property = new PropertyMetadata();
$property->name = substr($splitted[1], 1);
$property->isReadonly = $isReadonly;
$this->metadata->setProperty($property->name, $property);
$this->parseAnnotationTypes($property, $splitted[0]);
$this->parseAnnotationValue($property, isset($splitted[2]) ? $splitted[2] : null);
}
}
}