public function serialize(array $unserialized = null)
    {

        // do nothing, if the passed value is empty or NULL
        if ($unserialized === null || $unserialized === '') {
            return;
        }

        // load the global configuration
        $configuration = $this->getConfiguration();

        // initializet delimiter, enclosure and escape char
        $delimiter = $this->getDelimiter() ? $this->getDelimiter() : $configuration->getDelimiter();
        $enclosure = $configuration->getEnclosure();
        $escape = $configuration->getEscape();

        // create hte callback method to enclose/escape the values
        $callback = function ($value) use ($enclosure, $escape) {
            return $enclosure . str_replace($escape, $escape . $escape, $value) . $enclosure;
        };

        // implode and return the enclosed/escaped values
        return implode($delimiter, array_map($callback, $unserialized));
    }
public function serialize(array $unserialized = null)
    {

        // do nothing, if the passed value is empty or NULL
        if ($unserialized === null || $unserialized === '') {
            return;
        }

        // load the global configuration
        $configuration = $this->getConfiguration();

        // initializet delimiter, enclosure and escape char
        $delimiter = $this->getDelimiter() ? $this->getDelimiter() : $configuration->getDelimiter();
        $enclosure = $configuration->getEnclosure();
        $escape = $configuration->getEscape();

        // create hte callback method to enclose/escape the values
        $callback = function ($value) use ($enclosure, $escape) {
            return $enclosure . str_replace($escape, $escape . $escape, $value) . $enclosure;
        };

        // implode and return the enclosed/escaped values
        return implode($delimiter, array_map($callback, $unserialized));
    }
public function serialize ( array $ unserialized = null ) { // do nothing, if the passed value is empty or NULL if ( $ unserialized === null || $ unserialized === '' ) { return ; } // load the global configuration $ configuration = $ this -> getConfiguration ( ) ; // initializet delimiter, enclosure and escape char $ delimiter = $ this -> getDelimiter ( ) ? $ this -> getDelimiter ( ) : $ configuration -> getDelimiter ( ) ; $ enclosure = $ configuration -> getEnclosure ( ) ; $ escape = $ configuration -> getEscape ( ) ; // create hte callback method to enclose/escape the values $ callback = function ( $ value ) use ( $ enclosure , $ escape ) { return $ enclosure . str_replace ( $ escape , $ escape . $ escape , $ value ) . $ enclosure ; } ; // implode and return the enclosed/escaped values return implode ( $ delimiter , array_map ( $ callback , $ unserialized ) ) ; }
Serializes the elements of the passed array by using the
instances CSV configuration options.

@param array|null $unserialized The serialized data

@return string|null The serialized array
Serializes the elements of the passed array by using the instances CSV configuration options .