protected function stripBOM(Iterator $iterator, string $bom): Iterator
    {
        if ('' === $bom) {
            return $iterator;
        }

        $bom_length = mb_strlen($bom);
        $mapper = function (array $record, int $index) use ($bom_length): array {
            if (0 !== $index) {
                return $record;
            }

            return $this->removeBOM($record, $bom_length, $this->enclosure);
        };

        return new MapIterator($iterator, $mapper);
    }
protected function stripBOM(Iterator $iterator, string $bom): Iterator
    {
        if ('' === $bom) {
            return $iterator;
        }

        $bom_length = mb_strlen($bom);
        $mapper = function (array $record, int $index) use ($bom_length): array {
            if (0 !== $index) {
                return $record;
            }

            return $this->removeBOM($record, $bom_length, $this->enclosure);
        };

        return new MapIterator($iterator, $mapper);
    }
protected function stripBOM ( Iterator $ iterator , string $ bom ) : Iterator { if ( '' === $ bom ) { return $ iterator ; } $ bom_length = mb_strlen ( $ bom ) ; $ mapper = function ( array $ record , int $ index ) use ( $ bom_length ) : array { if ( 0 !== $ index ) { return $ record ; } return $ this -> removeBOM ( $ record , $ bom_length , $ this -> enclosure ) ; } ; return new MapIterator ( $ iterator , $ mapper ) ; }
Strip the BOM sequence from the returned records if necessary.
Strip the BOM sequence from the returned records if necessary .