public function getMethods()
{
if ($this->methods === null) {
$this->methods = $this->getOwnMethods();
foreach ($this->getOwnTraits() as $trait) {
if (!$trait instanceof ReflectionClass) {
continue;
}
foreach ($trait->getOwnMethods() as $method) {
if (isset($this->methods[$method->getName()])) {
continue;
}
if (!$this->isDocumented() || $method->isDocumented()) {
$this->methods[$method->getName()] = $method;
}
}
}
if (null !== $this->getParentClassName()) {
foreach ($this->getParentClass()->getMethods() as $parentMethod) {
if (!isset($this->methods[$parentMethod->getName()])) {
$this->methods[$parentMethod->getName()] = $parentMethod;
}
}
}
foreach ($this->getOwnInterfaces() as $interface) {
foreach ($interface->getMethods(null) as $parentMethod) {
if (!isset($this->methods[$parentMethod->getName()])) {
$this->methods[$parentMethod->getName()] = $parentMethod;
}
}
}
$this->methods = array_filter($this->methods, function (ReflectionMethod $method) {
return $method->configuration->getVisibilityLevel() === $this->getVisibilityLevel();
});
}
return $this->methods;
}