[ Index ]

PHP Cross Reference of phpBB-3.3.14-deutsch

title

Body

[close]

/vendor/s9e/text-formatter/src/Configurator/Exceptions/ -> UnsafeTemplateException.php (source)

   1  <?php
   2  
   3  /**
   4  * @package   s9e\TextFormatter
   5  * @copyright Copyright (c) 2010-2022 The s9e authors
   6  * @license   http://www.opensource.org/licenses/mit-license.php The MIT License
   7  */
   8  namespace s9e\TextFormatter\Configurator\Exceptions;
   9  
  10  use DOMNode;
  11  use RuntimeException;
  12  use s9e\TextFormatter\Configurator\Helpers\TemplateHelper;
  13  
  14  class UnsafeTemplateException extends RuntimeException
  15  {
  16      /**
  17      * @var DOMNode The node that is responsible for this exception
  18      */
  19      protected $node;
  20  
  21      /**
  22      * @param string  $msg  Exception message
  23      * @param DOMNode $node The node that is responsible for this exception
  24      */
  25  	public function __construct($msg, DOMNode $node)
  26      {
  27          parent::__construct($msg);
  28          $this->node = $node;
  29      }
  30  
  31      /**
  32      * Return the node that has caused this exception
  33      *
  34      * @return DOMNode
  35      */
  36  	public function getNode()
  37      {
  38          return $this->node;
  39      }
  40  
  41      /**
  42      * Highlight the source of the template that has caused this exception, with the node highlighted
  43      *
  44      * @param  string $prepend HTML to prepend
  45      * @param  string $append  HTML to append
  46      * @return string          Template's source, as HTML
  47      */
  48  	public function highlightNode($prepend = '<span style="background-color:#ff0">', $append = '</span>')
  49      {
  50          return TemplateHelper::highlightNode($this->node, $prepend, $append);
  51      }
  52  
  53      /**
  54      * Change the node associated with this exception
  55      *
  56      * @param  DOMNode $node
  57      * @return void
  58      */
  59  	public function setNode(DOMNode $node)
  60      {
  61          $this->node = $node;
  62      }
  63  }


Generated: Mon Nov 25 19:05:08 2024 Cross-referenced by PHPXref 0.7.1