original_string: public function addMessage(string $type, $message, string $channel = FlashMessengerInterface::DEFAULT_CHANNEL)
      {
          if (!is_string($message) && !is_array($message)) {
              throw new InvalidArgumentException('Flash message must be a string or an array of strings');
          }
  
          $container = $this->getSessionContainer();
          if (!isset($container->messages)) {
              $container->messages = [];
          }
  
          if (!isset($container->messages[$channel])) {
              $container->messages[$channel] = [];
          }
  
          if (!isset($container->messages[$channel][$type])) {
              $container->messages[$channel][$type] = [];
          }
  
          $message = (array)$message;
  
          foreach ($message as $msg) {
              if (!is_string($msg)) {
                  throw new InvalidArgumentException('Flash message must be a string or an array of strings');
              }
              $container->messages[$channel][$type][] = $msg;
          }
      }
code: public function addMessage(string $type, $message, string $channel = FlashMessengerInterface::DEFAULT_CHANNEL)
      {
          if (!is_string($message) && !is_array($message)) {
              throw new InvalidArgumentException('Flash message must be a string or an array of strings');
          }
  
          $container = $this->getSessionContainer();
          if (!isset($container->messages)) {
              $container->messages = [];
          }
  
          if (!isset($container->messages[$channel])) {
              $container->messages[$channel] = [];
          }
  
          if (!isset($container->messages[$channel][$type])) {
              $container->messages[$channel][$type] = [];
          }
  
          $message = (array)$message;
  
          foreach ($message as $msg) {
              if (!is_string($msg)) {
                  throw new InvalidArgumentException('Flash message must be a string or an array of strings');
              }
              $container->messages[$channel][$type][] = $msg;
          }
      }
code_tokens: public function addMessage ( string $ type , $ message , string $ channel = FlashMessengerInterface :: DEFAULT_CHANNEL ) { if ( ! is_string ( $ message ) && ! is_array ( $ message ) ) { throw new InvalidArgumentException ( 'Flash message must be a string or an array of strings' ) ; } $ container = $ this -> getSessionContainer ( ) ; if ( ! isset ( $ container -> messages ) ) { $ container -> messages = [ ] ; } if ( ! isset ( $ container -> messages [ $ channel ] ) ) { $ container -> messages [ $ channel ] = [ ] ; } if ( ! isset ( $ container -> messages [ $ channel ] [ $ type ] ) ) { $ container -> messages [ $ channel ] [ $ type ] = [ ] ; } $ message = ( array ) $ message ; foreach ( $ message as $ msg ) { if ( ! is_string ( $ msg ) ) { throw new InvalidArgumentException ( 'Flash message must be a string or an array of strings' ) ; } $ container -> messages [ $ channel ] [ $ type ] [ ] = $ msg ; } }
docstring: Add flash message
  
  @param string $type The namespace to store the message under
  @param mixed $message Message to show on next request
  @param string $channel
docstring_tokens: Add flash message