protected function parseTopDefinitions($topStatement, $aliasManager, $filepath, $namespace)
{
foreach ($topStatement as $statement) {
if ($statement instanceof Node\Stmt\Use_) {
if (!empty($statement->uses)) {
foreach ($statement->uses as $use) {
$aliasManager->add($use->name->parts);
}
}
} elseif ($statement instanceof Node\Stmt\Class_) {
$definition = new ClassDefinition($statement->name, $statement->type);
$definition->setFilepath($filepath);
$definition->setNamespace($namespace);
foreach ($statement->stmts as $stmt) {
if ($stmt instanceof Node\Stmt\ClassMethod) {
$method = new ClassMethod($stmt->name, $stmt, $stmt->type);
$definition->addMethod($method);
} elseif ($stmt instanceof Node\Stmt\Property) {
$definition->addProperty($stmt);
} elseif ($stmt instanceof Node\Stmt\ClassConst) {
$definition->addConst($stmt);
}
}
$this->getCompiler()->addClass($definition);
} elseif ($statement instanceof Node\Stmt\Function_) {
$definition = new FunctionDefinition($statement->name, $statement);
$definition->setFilepath($filepath);
$definition->setNamespace($namespace);
$this->getCompiler()->addFunction($definition);
}
}
}