/** * {@inheritdoc} */ public function extractFromClass(ClassReflectionInterface $reflectionClass) { $methods = []; if ($parentClass = $reflectionClass->getParentClass()) { $methods += $this->extractFromParentClass($parentClass, $reflectionClass->isDocumented()); } if ($traits = $reflectionClass->getTraits()) { $methods += $this->extractFromTraits($traits, $reflectionClass->isDocumented()); } return $methods; }
/** * {@inheritdoc} */ public function getUsedMagicProperties() { $properties = []; $allProperties = array_flip(array_map(function (PropertyReflectionInterface $property) { return $property->getName(); }, $this->getOwnMagicProperties())); foreach ($this->classReflection->getTraits() as $trait) { if (!$trait instanceof ClassReflectionInterface) { continue; } $usedProperties = $this->getUsedElements($trait->getOwnMagicProperties(), $allProperties); $properties = $this->sortElements($usedProperties, $properties, $trait); } return $properties; }
/** * {@inheritdoc} */ public function getUsedProperties() { $allProperties = array_flip(array_map(function (PropertyReflectionInterface $property) { return $property->getName(); }, $this->classReflection->getOwnProperties())); $properties = []; foreach ($this->classReflection->getTraits() as $trait) { if (!$trait instanceof ClassReflectionInterface) { continue; } $usedProperties = []; foreach ($trait->getOwnProperties() as $property) { if (!array_key_exists($property->getName(), $allProperties)) { $usedProperties[$property->getName()] = $property; $allProperties[$property->getName()] = NULL; } } if (!empty($usedProperties)) { ksort($usedProperties); $properties[$trait->getName()] = array_values($usedProperties); } } return $properties; }