1
0
mirror of https://github.com/vichan-devel/vichan.git synced 2024-12-22 12:25:59 +01:00
vichan/inc/lib/Twig/Markup.php

40 lines
810 B
PHP
Raw Normal View History

2011-10-05 06:22:53 +02:00
<?php
/*
* This file is part of Twig.
*
2018-05-10 12:24:53 +02:00
* (c) Fabien Potencier
2011-10-05 06:22:53 +02:00
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
/**
* Marks a content as safe.
*
2013-08-01 21:20:12 +02:00
* @author Fabien Potencier <fabien@symfony.com>
2011-10-05 06:22:53 +02:00
*/
2013-08-01 21:20:12 +02:00
class Twig_Markup implements Countable
2011-10-05 06:22:53 +02:00
{
protected $content;
2013-08-01 21:20:12 +02:00
protected $charset;
2011-10-05 06:22:53 +02:00
2013-08-01 21:20:12 +02:00
public function __construct($content, $charset)
2011-10-05 06:22:53 +02:00
{
$this->content = (string) $content;
2013-08-01 21:20:12 +02:00
$this->charset = $charset;
2011-10-05 06:22:53 +02:00
}
public function __toString()
{
return $this->content;
}
2013-08-01 21:20:12 +02:00
public function count()
{
return function_exists('mb_get_info') ? mb_strlen($this->content, $this->charset) : strlen($this->content);
}
2011-10-05 06:22:53 +02:00
}
2018-05-10 12:24:53 +02:00
class_alias('Twig_Markup', 'Twig\Markup', false);