/** * @param $properties array * @param $class Reflection_Class */ private function scanForGetters(&$properties, Reflection_Class $class) { foreach ($class->getProperties() as $property) { $expr = '%' . '\\n\\s+\\*\\s+' . '@getter' . '(?:\\s+(?:([\\\\\\w]+)::)?' . '(\\w+)?)?' . '%'; preg_match($expr, $property->getDocComment(), $match); if ($match) { $advice = [empty($match[1]) ? '$this' : $class->fullClassName($match[1]), empty($match[2]) ? Names::propertyToMethod($property->name, 'get') : $match[2]]; $properties[$property->name][] = ['read', $advice]; } } $overrides = $this->scanForOverrides($class->getDocComment([T_EXTENDS, T_USE]), ['getter']); foreach ($overrides as $match) { $advice = [empty($match['class_name']) ? '$this' : $match['class_name'], empty($match['method_name']) ? Names::propertyToMethod($match['property_name'], 'get') : $match['method_name']]; $properties[$match['property_name']][] = ['read', $advice]; } }