public static function encode( array $data ) {
		$format = ini_get( 'session.serialize_handler' );
		if ( !is_string( $format ) ) {
			throw new \UnexpectedValueException(
				'Could not fetch the value of session.serialize_handler'
			);
		}
		switch ( $format ) {
			case 'php':
				return self::encodePhp( $data );

			case 'php_binary':
				return self::encodePhpBinary( $data );

			case 'php_serialize':
				return self::encodePhpSerialize( $data );

			default:
				throw new \DomainException( "Unsupported format \"$format\"" );
		}
	}
public static function encode( array $data ) {
		$format = ini_get( 'session.serialize_handler' );
		if ( !is_string( $format ) ) {
			throw new \UnexpectedValueException(
				'Could not fetch the value of session.serialize_handler'
			);
		}
		switch ( $format ) {
			case 'php':
				return self::encodePhp( $data );

			case 'php_binary':
				return self::encodePhpBinary( $data );

			case 'php_serialize':
				return self::encodePhpSerialize( $data );

			default:
				throw new \DomainException( "Unsupported format \"$format\"" );
		}
	}
public static function encode ( array $ data ) { $ format = ini_get ( 'session.serialize_handler' ) ; if ( ! is_string ( $ format ) ) { throw new \ UnexpectedValueException ( 'Could not fetch the value of session.serialize_handler' ) ; } switch ( $ format ) { case 'php' : return self :: encodePhp ( $ data ) ; case 'php_binary' : return self :: encodePhpBinary ( $ data ) ; case 'php_serialize' : return self :: encodePhpSerialize ( $ data ) ; default : throw new \ DomainException ( "Unsupported format \"$format\"" ) ; } }
Encode a session array to a string, using the format in session.serialize_handler
@param array $data Session data
@return string|null Encoded string, or null on failure
@throws \\DomainException
Encode a session array to a string using the format in session . serialize_handler