You are here

class PiwikJavaScriptSnippet in Piwik Web Analytics 8

Formats a string for JavaScript display.

Hierarchy

Expanded class hierarchy of PiwikJavaScriptSnippet

1 file declares its use of PiwikJavaScriptSnippet
piwik.module in ./piwik.module
Drupal Module: Piwik.

File

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

Namespace

Drupal\piwik\Component\Render
View source
class PiwikJavaScriptSnippet 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
PiwikJavaScriptSnippet::$string protected property The string to escape.
PiwikJavaScriptSnippet::jsonSerialize public function
PiwikJavaScriptSnippet::__construct public function Constructs an HtmlEscapedText object.
PiwikJavaScriptSnippet::__toString public function Returns markup. Overrides MarkupInterface::__toString