public static function generateSpyClassRepresenting($type)
    {
        $spyClassName = str_replace('\\', '_', $type).'_NarkSpy';
        if (in_array($spyClassName, self::$loadedSpyClasses)) {
            return "\\Nark\\{$spyClassName}";
        }

        if (class_exists($type)) {
            $spyClassCode = self::createSpyClassExtendingClass($spyClassName, $type);
        } elseif (interface_exists($type)) {
            $spyClassCode = self::createSpyClassImplementingInterface($spyClassName, $type);
        } else {
            throw new InvalidArgumentException('Can only create a spy representing a single class or interface');
        }

        // var_export($spyClassCode);
        eval($spyClassCode);
        self::$loadedSpyClasses[] = $spyClassName;

        return "\\Nark\\{$spyClassName}";
    }