protected function extractParentClassInformation($parentClass, &$methods)
{
if (!class_exists($parentClass)) {
throw new ClassNotFoundException();
}
$reflection = new \ReflectionClass($parentClass);
$root = realpath($this->jarves->getRootDir() . '/../');
// $parentPath = substr($reflection->getFileName(), strlen($root) + 1);
$parentContent = explode("\n", file_get_contents($reflection->getFileName()));
$parentReflection = new \ReflectionClass($parentClass);
$methods2 = $parentReflection->getMethods();
foreach ($methods2 as $method) {
if (isset($methods[$method->name])) {
continue;
}
if ($method->class == $parentClass) {
$code = '';
$startLine = $method->getStartLine();
$endLine = $method->getEndLine();
for ($i = $startLine - 1; $i < $method->getEndLine(); $i++) {
$code .= @$parentContent[$i] . "\n";
if (strpos(@$parentContent[$i], '{')) {
break;
}
}
if ($doc = $method->getDocComment()) {
$code = " {$doc}\n{$code}";
}
$methods[$method->name] = str_replace("\r", '', $code);
}
}
$parent = $parentReflection->getParentClass();
if ($parent) {
$this->extractParentClassInformation($parent->name, $methods);
}
}