public static function serialize($object)
    {
        $masked = false;

        if (false === is_object($object)) {
            $object = self::mask($object);
            $masked = true;
        }

        $capsule = new \stdClass();
        $capsule->type = get_class($object);
        $capsule->object = $object;
        $capsule->fake = $masked;

        if ($object instanceof \SimpleXMLElement) {
            $capsule->object = $object->asXml();
        }

        return '' . self::serializeNative($capsule);
    }