protected function serializeValue($value)
    {
        if ($this->isSerializable($value) === true) {
            // Activate default bit to detect serialization
            $value = serialize($value);
            $bytes = strlen($value);
            $flags = self::FLAG_DECIMAL_SERIALIZED;

        } else {
            // Real numbers should keep real numbers - Bit 2 = int , 3 = double/float
            if (is_int($value) === true) {
                $flags = self::FLAG_DECIMAL_INTEGER;

            } elseif (is_float($value) === true) {
                $flags = self::FLAG_DECIMAL_FLOAT;

            } elseif (is_string($value) === true) {
                // Never serialize strings! Otherwise append() & prepend() won't work!
                $flags = self::FLAG_DECIMAL_STRING;

            } elseif (is_bool($value) === true) {
                $value = strval($value);
                $flags = self::FLAG_DECIMAL_BOOLEAN;

            } else {
                throw new Exception(
                    sprintf('Unhandable value. Don\'t know how to process!')
                );
            }

            $bytes = strlen($value);
        }

        return array(
            'value' => $value,
            'flags' => $flags,
            'bytes' => $bytes,
        );
    }
protected function serializeValue($value)
    {
        if ($this->isSerializable($value) === true) {
            // Activate default bit to detect serialization
            $value = serialize($value);
            $bytes = strlen($value);
            $flags = self::FLAG_DECIMAL_SERIALIZED;

        } else {
            // Real numbers should keep real numbers - Bit 2 = int , 3 = double/float
            if (is_int($value) === true) {
                $flags = self::FLAG_DECIMAL_INTEGER;

            } elseif (is_float($value) === true) {
                $flags = self::FLAG_DECIMAL_FLOAT;

            } elseif (is_string($value) === true) {
                // Never serialize strings! Otherwise append() & prepend() won't work!
                $flags = self::FLAG_DECIMAL_STRING;

            } elseif (is_bool($value) === true) {
                $value = strval($value);
                $flags = self::FLAG_DECIMAL_BOOLEAN;

            } else {
                throw new Exception(
                    sprintf('Unhandable value. Don\'t know how to process!')
                );
            }

            $bytes = strlen($value);
        }

        return array(
            'value' => $value,
            'flags' => $flags,
            'bytes' => $bytes,
        );
    }
protected function serializeValue ( $ value ) { if ( $ this -> isSerializable ( $ value ) === true ) { // Activate default bit to detect serialization $ value = serialize ( $ value ) ; $ bytes = strlen ( $ value ) ; $ flags = self :: FLAG_DECIMAL_SERIALIZED ; } else { // Real numbers should keep real numbers - Bit 2 = int , 3 = double/float if ( is_int ( $ value ) === true ) { $ flags = self :: FLAG_DECIMAL_INTEGER ; } elseif ( is_float ( $ value ) === true ) { $ flags = self :: FLAG_DECIMAL_FLOAT ; } elseif ( is_string ( $ value ) === true ) { // Never serialize strings! Otherwise append() & prepend() won't work! $ flags = self :: FLAG_DECIMAL_STRING ; } elseif ( is_bool ( $ value ) === true ) { $ value = strval ( $ value ) ; $ flags = self :: FLAG_DECIMAL_BOOLEAN ; } else { throw new Exception ( sprintf ( 'Unhandable value. Don\'t know how to process!' ) ) ; } $ bytes = strlen ( $ value ) ; } return array ( 'value' => $ value , 'flags' => $ flags , 'bytes' => $ bytes , ) ; }
Serializes a value if it is serializable in our meaning.

@param mixed $value The value to serialize

@author Benjamin Carl <opensource@clickalicious.de>
@return array ...
@access protected
@throws \Clickalicious\Memcached\Exception
Serializes a value if it is serializable in our meaning .