public function insertOne(array $record): int
    {
        $method = 'addRecord';
        if (70400 > PHP_VERSION_ID && '' === $this->escape) {
            $method = 'addRFC4180CompliantRecord';
        }

        $record = array_reduce($this->formatters, [$this, 'formatRecord'], $record);
        $this->validateRecord($record);
        $bytes = $this->$method($record);
        if (false !== $bytes && 0 !== $bytes) {
            return $bytes + $this->consolidate();
        }

        throw CannotInsertRecord::triggerOnInsertion($record);
    }
public function insertOne(array $record): int
    {
        $method = 'addRecord';
        if (70400 > PHP_VERSION_ID && '' === $this->escape) {
            $method = 'addRFC4180CompliantRecord';
        }

        $record = array_reduce($this->formatters, [$this, 'formatRecord'], $record);
        $this->validateRecord($record);
        $bytes = $this->$method($record);
        if (false !== $bytes && 0 !== $bytes) {
            return $bytes + $this->consolidate();
        }

        throw CannotInsertRecord::triggerOnInsertion($record);
    }
public function insertOne ( array $ record ) : int { $ method = 'addRecord' ; if ( 70400 > PHP_VERSION_ID && '' === $ this -> escape ) { $ method = 'addRFC4180CompliantRecord' ; } $ record = array_reduce ( $ this -> formatters , [ $ this , 'formatRecord' ] , $ record ) ; $ this -> validateRecord ( $ record ) ; $ bytes = $ this -> $ method ( $ record ) ; if ( false !== $ bytes && 0 !== $ bytes ) { return $ bytes + $ this -> consolidate ( ) ; } throw CannotInsertRecord :: triggerOnInsertion ( $ record ) ; }
Adds a single record to a CSV document.

A record is an array that can contains scalar types values, NULL values
or objects implementing the __toString method.

@throws CannotInsertRecord If the record can not be inserted
Adds a single record to a CSV document .