src/Sqs/SqsClient.php
private static function calculateMessageAttributesMd5($message)
    {
        if (empty($message['MessageAttributes'])
            || !is_array($message['MessageAttributes'])
        ) {
            return null;
        }

        ksort($message['MessageAttributes']);
        $attributeValues = "";
        foreach ($message['MessageAttributes'] as $name => $details) {
            $attributeValues .= self::getEncodedStringPiece($name);
            $attributeValues .= self::getEncodedStringPiece($details['DataType']);
            if (substr($details['DataType'], 0, 6) === 'Binary') {
                $attributeValues .= pack('c', 0x02);
                $attributeValues .= self::getEncodedBinaryPiece(
                    $details['BinaryValue']
                );
            } else {
                $attributeValues .= pack('c', 0x01);
                $attributeValues .= self::getEncodedStringPiece(
                    $details['StringValue']
                );
            }
        }

        return md5($attributeValues);
    }
private static function calculateMessageAttributesMd5($message)
    {
        if (empty($message['MessageAttributes'])
            || !is_array($message['MessageAttributes'])
        ) {
            return null;
        }

        ksort($message['MessageAttributes']);
        $attributeValues = "";
        foreach ($message['MessageAttributes'] as $name => $details) {
            $attributeValues .= self::getEncodedStringPiece($name);
            $attributeValues .= self::getEncodedStringPiece($details['DataType']);
            if (substr($details['DataType'], 0, 6) === 'Binary') {
                $attributeValues .= pack('c', 0x02);
                $attributeValues .= self::getEncodedBinaryPiece(
                    $details['BinaryValue']
                );
            } else {
                $attributeValues .= pack('c', 0x01);
                $attributeValues .= self::getEncodedStringPiece(
                    $details['StringValue']
                );
            }
        }

        return md5($attributeValues);
    }
private static function calculateMessageAttributesMd5 ( $ message ) { if ( empty ( $ message [ 'MessageAttributes' ] ) || ! is_array ( $ message [ 'MessageAttributes' ] ) ) { return null ; } ksort ( $ message [ 'MessageAttributes' ] ) ; $ attributeValues = "" ; foreach ( $ message [ 'MessageAttributes' ] as $ name => $ details ) { $ attributeValues .= self :: getEncodedStringPiece ( $ name ) ; $ attributeValues .= self :: getEncodedStringPiece ( $ details [ 'DataType' ] ) ; if ( substr ( $ details [ 'DataType' ] , 0 , 6 ) === 'Binary' ) { $ attributeValues .= pack ( 'c' , 0x02 ) ; $ attributeValues .= self :: getEncodedBinaryPiece ( $ details [ 'BinaryValue' ] ) ; } else { $ attributeValues .= pack ( 'c' , 0x01 ) ; $ attributeValues .= self :: getEncodedStringPiece ( $ details [ 'StringValue' ] ) ; } } return md5 ( $ attributeValues ) ; }
Calculates the expected md5 hash of message attributes according to the encoding
scheme detailed in SQS documentation.

@param array $message Message containing attributes for validation.
Retrieved when using MessageAttributeNames on
ReceiveMessage.

@return string|null The md5 hash of the message attributes according to
the encoding scheme. Returns null when there are no
attributes.
@link http://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-message-attributes.html#message-attributes-items-validation
Calculates the expected md5 hash of message attributes according to the encoding scheme detailed in SQS documentation .