private static function filterDocument($document)
    {
        if ($document instanceof Stream || $document instanceof SplFileObject) {
            return $document;
        }

        throw new TypeError(sprintf(
            '%s::parse expects parameter 1 to be a %s or a SplFileObject object, %s given',
            self::class,
            Stream::class,
            is_object($document) ? get_class($document) : gettype($document)
        ));
    }
private static function filterDocument($document)
    {
        if ($document instanceof Stream || $document instanceof SplFileObject) {
            return $document;
        }

        throw new TypeError(sprintf(
            '%s::parse expects parameter 1 to be a %s or a SplFileObject object, %s given',
            self::class,
            Stream::class,
            is_object($document) ? get_class($document) : gettype($document)
        ));
    }
private static function filterDocument ( $ document ) { if ( $ document instanceof Stream || $ document instanceof SplFileObject ) { return $ document ; } throw new TypeError ( sprintf ( '%s::parse expects parameter 1 to be a %s or a SplFileObject object, %s given' , self :: class , Stream :: class , is_object ( $ document ) ? get_class ( $ document ) : gettype ( $ document ) ) ) ; }
Filters the submitted document.

@param SplFileObject|Stream $document

@return SplFileObject|Stream
Filters the submitted document .