code: protected static function getTemplateByCode(
          /*# int */ $code,
          /*# string */ $class
      )/*# : string */ {
          // default template, last resort
          if (__CLASS__ === $class) {
              return "unknown message code: $code, %s";
          }
  
          // check $class
          if ($class::messageDefined($code)) {
              // load message mapping for $class
              $class::loadMappings();
  
              // get the message template
              return $class::getMessage($code);
          }
  
          // search upwards
          return self::getTemplateByCode($code, get_parent_class($class));
      }
docs: Resolving $code to message template, start from $class
  
  @param  int $code message code
  @param  string $class class name
  @return string
  @access protected