src/Detail/Bernard/Message/Messenger.php
public function decodeMessage(BernardMessage $message)
    {
        if (!isset($message->{self::MESSAGE_CLASS_KEY})) {
            throw new Exception\RuntimeException(
                sprintf('Message is missing key "%s"', self::MESSAGE_CLASS_KEY)
            );
        }

        if (!is_string($message->{self::MESSAGE_CLASS_KEY})) {
            throw new Exception\RuntimeException(
                sprintf('Message has invalid value for key "%s"; must be a string', self::MESSAGE_CLASS_KEY)
            );
        }

        if (!isset($message->{self::MESSAGE_KEY})) {
            throw new Exception\RuntimeException(
                sprintf('Message is missing key "%s"', self::MESSAGE_KEY)
            );
        }

        if (!is_array($message->{self::MESSAGE_KEY})) {
            throw new Exception\RuntimeException(
                sprintf('Message has invalid value for key "%s"; must be an array', self::MESSAGE_KEY)
            );
        }

        return $this->getMessageFactory()->createFromArray(
            $message->{self::MESSAGE_KEY},
            $message->{self::MESSAGE_CLASS_KEY}
        );
    }
public function decodeMessage(BernardMessage $message)
    {
        if (!isset($message->{self::MESSAGE_CLASS_KEY})) {
            throw new Exception\RuntimeException(
                sprintf('Message is missing key "%s"', self::MESSAGE_CLASS_KEY)
            );
        }

        if (!is_string($message->{self::MESSAGE_CLASS_KEY})) {
            throw new Exception\RuntimeException(
                sprintf('Message has invalid value for key "%s"; must be a string', self::MESSAGE_CLASS_KEY)
            );
        }

        if (!isset($message->{self::MESSAGE_KEY})) {
            throw new Exception\RuntimeException(
                sprintf('Message is missing key "%s"', self::MESSAGE_KEY)
            );
        }

        if (!is_array($message->{self::MESSAGE_KEY})) {
            throw new Exception\RuntimeException(
                sprintf('Message has invalid value for key "%s"; must be an array', self::MESSAGE_KEY)
            );
        }

        return $this->getMessageFactory()->createFromArray(
            $message->{self::MESSAGE_KEY},
            $message->{self::MESSAGE_CLASS_KEY}
        );
    }
public function decodeMessage ( BernardMessage $ message ) { if ( ! isset ( $ message -> { self :: MESSAGE_CLASS_KEY } ) ) { throw new Exception \ RuntimeException ( sprintf ( 'Message is missing key "%s"' , self :: MESSAGE_CLASS_KEY ) ) ; } if ( ! is_string ( $ message -> { self :: MESSAGE_CLASS_KEY } ) ) { throw new Exception \ RuntimeException ( sprintf ( 'Message has invalid value for key "%s"; must be a string' , self :: MESSAGE_CLASS_KEY ) ) ; } if ( ! isset ( $ message -> { self :: MESSAGE_KEY } ) ) { throw new Exception \ RuntimeException ( sprintf ( 'Message is missing key "%s"' , self :: MESSAGE_KEY ) ) ; } if ( ! is_array ( $ message -> { self :: MESSAGE_KEY } ) ) { throw new Exception \ RuntimeException ( sprintf ( 'Message has invalid value for key "%s"; must be an array' , self :: MESSAGE_KEY ) ) ; } return $ this -> getMessageFactory ( ) -> createFromArray ( $ message -> { self :: MESSAGE_KEY } , $ message -> { self :: MESSAGE_CLASS_KEY } ) ; }
Decode message from Bernard.

@param BernardMessage $message
@return mixed
@throws Exception\RuntimeException
Decode message from Bernard .