original_string: public function setMessage($tag, $args = array())
      {
          if (!is_array($args)) {
              $args = array($args);
          }
          $fmt = $this->app->_($this->get($tag));
  
          // Try to analyze format and see which formatter to use
          if (class_exists('MessageFormatter', false) && strpos($fmt, '{') !== null) {
              $fmt = new MessageFormatter($this->app->locale, $fmt);
              $str = $fmt->format($args);
          } elseif (strpos($fmt, '%') !== null) {
              // Else, perhaps it's a sprintf?
              array_unshift($args, $fmt);
              $str = call_user_func_array('sprintf', $args);
          } else {
              throw $this->exception('Unclear how to format this')
                  ->addMoreInfo('fmt', $fmt)
                  ;
          }
  
          return $this->set($tag, $str);
      }
code: public function setMessage($tag, $args = array())
      {
          if (!is_array($args)) {
              $args = array($args);
          }
          $fmt = $this->app->_($this->get($tag));
  
          // Try to analyze format and see which formatter to use
          if (class_exists('MessageFormatter', false) && strpos($fmt, '{') !== null) {
              $fmt = new MessageFormatter($this->app->locale, $fmt);
              $str = $fmt->format($args);
          } elseif (strpos($fmt, '%') !== null) {
              // Else, perhaps it's a sprintf?
              array_unshift($args, $fmt);
              $str = call_user_func_array('sprintf', $args);
          } else {
              throw $this->exception('Unclear how to format this')
                  ->addMoreInfo('fmt', $fmt)
                  ;
          }
  
          return $this->set($tag, $str);
      }
code_tokens: public function setMessage ( $ tag , $ args = array ( ) ) { if ( ! is_array ( $ args ) ) { $ args = array ( $ args ) ; } $ fmt = $ this -> app -> _ ( $ this -> get ( $ tag ) ) ; // Try to analyze format and see which formatter to use if ( class_exists ( 'MessageFormatter' , false ) && strpos ( $ fmt , '{' ) !== null ) { $ fmt = new MessageFormatter ( $ this -> app -> locale , $ fmt ) ; $ str = $ fmt -> format ( $ args ) ; } elseif ( strpos ( $ fmt , '%' ) !== null ) { // Else, perhaps it's a sprintf? array_unshift ( $ args , $ fmt ) ; $ str = call_user_func_array ( 'sprintf' , $ args ) ; } else { throw $ this -> exception ( 'Unclear how to format this' ) -> addMoreInfo ( 'fmt' , $ fmt ) ; } return $ this -> set ( $ tag , $ str ) ; }
docstring: Provided that the HTML tag contains ICU-compatible message format
  string, it will be localized then integrated with passed arguments.
docstring_tokens: Provided that the HTML tag contains ICU - compatible message format string it will be localized then integrated with passed arguments .