You are here

class MatomoJavaScriptSnippet in Matomo Analytics 8

Formats a string for JavaScript display.

Hierarchy

Expanded class hierarchy of MatomoJavaScriptSnippet

1 file declares its use of MatomoJavaScriptSnippet
matomo.module in ./matomo.module
Drupal Module: Matomo.

File

src/Component/Render/MatomoJavaScriptSnippet.php, line 10

Namespace

Drupal\matomo\Component\Render
View source
class MatomoJavaScriptSnippet implements MarkupInterface {

  /**
   * The string to escape.
   *
   * @var string
   */
  protected $string;

  /**
   * Constructs an HtmlEscapedText object.
   *
   * @param string $string
   *   The string to escape. This value will be cast to a string.
   */
  public function __construct($string) {
    $this->string = (string) $string;
  }

  /**
   * {@inheritdoc}
   */
  public function __toString() {
    return $this->string;
  }

  /**
   * {@inheritdoc}
   */
  public function jsonSerialize() {
    return $this
      ->__toString();
  }

}

Members

Namesort descending Modifiers Type Description Overrides
MatomoJavaScriptSnippet::$string protected property The string to escape.
MatomoJavaScriptSnippet::jsonSerialize public function
MatomoJavaScriptSnippet::__construct public function Constructs an HtmlEscapedText object.
MatomoJavaScriptSnippet::__toString public function Returns markup. Overrides MarkupInterface::__toString