1
0
mirror of https://github.com/vichan-devel/vichan.git synced 2024-11-24 07:30:10 +01:00
vichan/inc/lib/Twig/Markup.php

38 lines
764 B
PHP
Raw Normal View History

2011-10-05 06:22:53 +02:00
<?php
/*
* This file is part of Twig.
*
* (c) 2010 Fabien Potencier
*
* 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
}