code: private static function detectMode($param)
      {
          static $mapping = null;
          if ($mapping === null) {
              $keys = array(
                  self::MODE_HTML4_TRANSITIONAL,
                  self::MODE_HTML4_STRICT,
                  self::MODE_XHTML1_STRICT,
                  self::MODE_XHTML1_TRANSITIONAL,
                  self::MODE_XHTML1_1,
                  self::MODE_HTML5,
              );
              $altMapping = array(
                  ""      => self::MODE_HTML5,
                  "html"  => self::MODE_HTML5,
                  "html4" => self::MODE_HTML4_TRANSITIONAL,
                  "xhtml" => self::MODE_XHTML1_TRANSITIONAL,
              );
              $mapping = array_merge(array_combine($keys, $keys), $altMapping);
          }
          
          $key = strtolower($param);
          if (array_key_exists($key, $mapping)) {
              return $mapping[$key];
          } else {
              throw new InvalidArgumentException("Invalid mode name: {$param}");
          }
      }
docs: newInstance() の引数で指定された文字列のバリデーションを行います.
  未対応の文字列が指定された場合は InvalidArgumentException をスローします.
  
  @param  string $param
  @return string
  @throws InvalidArgumentException