Parses a class.
\ReflectionClass $class A <code>ReflectionClass</code> object.:
array A list with use statements in the form (Alias => FQN).
public function parseClass(\ReflectionClass $class) {
if (method_exists($class, 'getUseStatements')) {
return $class
->getUseStatements();
}
if (false === ($filename = $class
->getFilename())) {
return array();
}
$content = $this
->getFileContent($filename, $class
->getStartLine());
$namespace = str_replace('\\', '\\\\', $class
->getNamespaceName());
$content = preg_replace('/^.*?(\\bnamespace\\s+' . $namespace . '\\s*[;{].*)$/s', '\\1', $content);
$tokenizer = new TokenParser('<?php ' . $content);
$statements = $tokenizer
->parseUseStatements($class
->getNamespaceName());
return $statements;
}