vendor/twig/twig/src/Markup.php line 38

Open in your IDE?
  1. <?php
  2. /*
  3.  * This file is part of Twig.
  4.  *
  5.  * (c) Fabien Potencier
  6.  *
  7.  * For the full copyright and license information, please view the LICENSE
  8.  * file that was distributed with this source code.
  9.  */
  10. namespace Twig;
  11. /**
  12.  * Marks a content as safe.
  13.  *
  14.  * @author Fabien Potencier <fabien@symfony.com>
  15.  */
  16. class Markup implements \Countable\JsonSerializable
  17. {
  18.     private $content;
  19.     private $charset;
  20.     public function __construct($content$charset)
  21.     {
  22.         $this->content = (string) $content;
  23.         $this->charset $charset;
  24.     }
  25.     public function __toString()
  26.     {
  27.         return $this->content;
  28.     }
  29.     /**
  30.      * @return int
  31.      */
  32.     public function count()
  33.     {
  34.         return mb_strlen($this->content$this->charset);
  35.     }
  36.     public function jsonSerialize()
  37.     {
  38.         return $this->content;
  39.     }
  40. }