public static function generate($originalClassName, array $methods = null, array $properties = null,
                                    $proxyClassName = '', $callAutoload = false)
    {

        self::$exposeMethods = false;
        self::$exposeProperties = false;

        if ($proxyClassName == '') {
            $key = md5(
                $originalClassName . serialize($methods) . serialize($properties)
            );

            if (isset(self::$cache[$key])) {
                return self::$cache[$key];
            }
        }

        if (!empty($methods)) {
            self::$exposeMethods = true;
        }

        if (!empty($properties)) {
            self::$exposeProperties = true;
        }

        $proxy = self::generateProxy(
            $originalClassName, $methods, $properties, $proxyClassName, $callAutoload
        );

        if (isset($key)) {
            self::$cache[$key] = $proxy;
        }

        return $proxy;
    }