src/Eloquent/Typhoon/ClassMapper/ClassMapper.php
public function classesBySource($source)
    {
        $this->typeCheck->classesBySource(func_get_args());

        $classDefinitions = array();
        $namespaceName = null;
        $usedClasses = array();
        $tokens = $this->isolator->token_get_all($source);

        while ($token = next($tokens)) {
            if (is_array($token)) {
                switch ($token[0]) {
                    case T_NAMESPACE:
                        $namespaceName = $this->parseNamespaceName($tokens);
                        $usedClasses = array();
                        break;
                    case T_USE:
                        $usedClasses[] = $this->parseUsedClass($tokens);
                        break;
                    case T_CLASS:
                        $classDefinitions[] = $this->parseClassDefinition(
                            $tokens,
                            $namespaceName,
                            $usedClasses
                        );
                        break;
                }
            }
        }

        return $classDefinitions;
    }
public function classesBySource($source)
    {
        $this->typeCheck->classesBySource(func_get_args());

        $classDefinitions = array();
        $namespaceName = null;
        $usedClasses = array();
        $tokens = $this->isolator->token_get_all($source);

        while ($token = next($tokens)) {
            if (is_array($token)) {
                switch ($token[0]) {
                    case T_NAMESPACE:
                        $namespaceName = $this->parseNamespaceName($tokens);
                        $usedClasses = array();
                        break;
                    case T_USE:
                        $usedClasses[] = $this->parseUsedClass($tokens);
                        break;
                    case T_CLASS:
                        $classDefinitions[] = $this->parseClassDefinition(
                            $tokens,
                            $namespaceName,
                            $usedClasses
                        );
                        break;
                }
            }
        }

        return $classDefinitions;
    }
@param string $source

@return array<ClassDefinition>