original_string: 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;
      }
code: 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;
      }
code_tokens: 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 ; }
docstring: 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
docstring_tokens: Add a message to this message bag .