src/Message/Bag.php
public function addMessage($message, $type)
    {
        if (!is_string($message)) {
            throw new \InvalidArgumentException('Message must be a string');
        }
        if (!$message) {
            throw new \InvalidArgumentException('Message can\'t be empty');
        }
        if (!is_string($type)) {
            throw new \InvalidArgumentException('Type must be a string');
        }
        if (!$type) {
            throw new \InvalidArgumentException('Type can\'t be empty');
        }
        $this->messages[$type][] = $message;

        return $this;
    }
public function addMessage($message, $type)
    {
        if (!is_string($message)) {
            throw new \InvalidArgumentException('Message must be a string');
        }
        if (!$message) {
            throw new \InvalidArgumentException('Message can\'t be empty');
        }
        if (!is_string($type)) {
            throw new \InvalidArgumentException('Type must be a string');
        }
        if (!$type) {
            throw new \InvalidArgumentException('Type can\'t be empty');
        }
        $this->messages[$type][] = $message;

        return $this;
    }
public function addMessage ( $ message , $ type ) { if ( ! is_string ( $ message ) ) { throw new \ InvalidArgumentException ( 'Message must be a string' ) ; } if ( ! $ message ) { throw new \ InvalidArgumentException ( 'Message can\'t be empty' ) ; } if ( ! is_string ( $ type ) ) { throw new \ InvalidArgumentException ( 'Type must be a string' ) ; } if ( ! $ type ) { throw new \ InvalidArgumentException ( 'Type can\'t be empty' ) ; } $ this -> messages [ $ type ] [ ] = $ message ; return $ this ; }
Add a message to this message bag.

@param string $message The message to add.
@param string $type    The type of message to add.

@throws  \InvalidArgumentException When the provided data is incorrect.
@return Bag
Add a message to this message bag .