original_string: public static function addFormat($format, array $strings)
      {
          $self = Debugger::getInstance();
          if (isset($self->_templates[$format])) {
              if (isset($strings['links'])) {
                  $self->_templates[$format]['links'] = array_merge(
                      $self->_templates[$format]['links'],
                      $strings['links']
                  );
                  unset($strings['links']);
              }
              $self->_templates[$format] = $strings + $self->_templates[$format];
          } else {
              $self->_templates[$format] = $strings;
          }
  
          return $self->_templates[$format];
      }
code: public static function addFormat($format, array $strings)
      {
          $self = Debugger::getInstance();
          if (isset($self->_templates[$format])) {
              if (isset($strings['links'])) {
                  $self->_templates[$format]['links'] = array_merge(
                      $self->_templates[$format]['links'],
                      $strings['links']
                  );
                  unset($strings['links']);
              }
              $self->_templates[$format] = $strings + $self->_templates[$format];
          } else {
              $self->_templates[$format] = $strings;
          }
  
          return $self->_templates[$format];
      }
code_tokens: public static function addFormat ( $ format , array $ strings ) { $ self = Debugger :: getInstance ( ) ; if ( isset ( $ self -> _templates [ $ format ] ) ) { if ( isset ( $ strings [ 'links' ] ) ) { $ self -> _templates [ $ format ] [ 'links' ] = array_merge ( $ self -> _templates [ $ format ] [ 'links' ] , $ strings [ 'links' ] ) ; unset ( $ strings [ 'links' ] ) ; } $ self -> _templates [ $ format ] = $ strings + $ self -> _templates [ $ format ] ; } else { $ self -> _templates [ $ format ] = $ strings ; } return $ self -> _templates [ $ format ] ; }
docstring: Add an output format or update a format in Debugger.
  
  ```
  Debugger::addFormat('custom', $data);
  ```
  
  Where $data is an array of strings that use Text::insert() variable
  replacement. The template vars should be in a `{:id}` style.
  An error formatter can have the following keys:
  
  - 'error' - Used for the container for the error message. Gets the following template
  variables: `id`, `error`, `code`, `description`, `path`, `line`, `links`, `info`
  - 'info' - A combination of `code`, `context` and `trace`. Will be set with
  the contents of the other template keys.
  - 'trace' - The container for a stack trace. Gets the following template
  variables: `trace`
  - 'context' - The container element for the context variables.
  Gets the following templates: `id`, `context`
  - 'links' - An array of HTML links that are used for creating links to other resources.
  Typically this is used to create javascript links to open other sections.
  Link keys, are: `code`, `context`, `help`. See the js output format for an
  example.
  - 'traceLine' - Used for creating lines in the stacktrace. Gets the following
  template variables: `reference`, `path`, `line`
  
  Alternatively if you want to use a custom callback to do all the formatting, you can use
  the callback key, and provide a callable:
  
  ```
  Debugger::addFormat('custom', ['callback' => [$foo, 'outputError']];
  ```
  
  The callback can expect two parameters. The first is an array of all
  the error data. The second contains the formatted strings generated using
  the other template strings. Keys like `info`, `links`, `code`, `context` and `trace`
  will be present depending on the other templates in the format type.
  
  @param string $format Format to use, including 'js' for JavaScript-enhanced HTML, 'html' for
  straight HTML output, or 'txt' for unformatted text.
  @param array $strings Template strings, or a callback to be used for the output format.
  @return array The resulting format string set.
docstring_tokens: Add an output format or update a format in Debugger .