protected function parse(\SplFileInfo $file)
    {
        if ($file->getExtension() !== 'php') {
            throw new \InvalidArgumentException(
                'Invalid file type.'
            );
        }
        $info = [];
        $tokens = token_get_all($file->getContents());

        for ($i = 0; $i < count($tokens); ++$i) {
            $token = is_array($tokens[$i])
                ? $tokens[$i][0]
                : $tokens[$i];

            switch ($token) {
                case T_NAMESPACE:
                    $info[$tokens[$i][1]] = $this->getTokenValue(
                        $tokens,
                        [';'],
                        $i
                    );
                    continue;

                case T_USE:
                    $info[$tokens[$i][1]][] = $this->getTokenValue(
                        $tokens,
                        [';', '{', T_AS],
                        $i
                    );
                    continue;

                case T_CLASS:
                    $classname = $this->getTokenValue(
                        $tokens,
                        [T_EXTENDS, T_IMPLEMENTS, '{'],
                        $i
                    );

                    // Resolve the class fully qualified namespace.
                    $info[$tokens[$i][1]] = $this->resolveNamespace(
                        $info,
                        $classname
                    );

                    continue;

                case T_EXTENDS:
                    $classname = $this->getTokenValue(
                        $tokens,
                        [T_IMPLEMENTS, '{'],
                        $i
                    );

                    // Resolve the extends class fully qualified namespace.
                    $info[$tokens[$i][1]] = $this->resolveNamespace(
                        $info,
                        $classname
                    );

                    continue;

                case T_IMPLEMENTS:
                    $interface = $this->getTokenValue(
                        $tokens,
                        ['{'],
                        $i
                    );

                    // Resolve the interface fully qualified namespace.
                    $info[$tokens[$i][1]][] = $this->resolveNamespace(
                        $info,
                        $interface
                    );

                    continue;
            }
        }

        return $info;
    }