public static function create($content): ?self
    {
        if (is_string($content)) {
            return self::fromString($content);
        }

        return $content ? self::cast($content) : null;
    }
public static function create($content): ?self
    {
        if (is_string($content)) {
            return self::fromString($content);
        }

        return $content ? self::cast($content) : null;
    }
public static function create ( $ content ) : ? self { if ( is_string ( $ content ) ) { return self :: fromString ( $ content ) ; } return $ content ? self :: cast ( $ content ) : null ; }
Safely create a document.

@param $content
@return Document|null
Safely create a document .