[OutputEscaper] added SafeDecoratorInterface
This commit is contained in:
parent
7650dd708f
commit
6aa190b2a6
@ -118,18 +118,18 @@ abstract class Escaper
|
||||
return $copy;
|
||||
}
|
||||
|
||||
if (self::isClassMarkedAsSafe(get_class($value))) {
|
||||
// the class or one of its children is marked as safe
|
||||
// return the unescaped object
|
||||
return $value;
|
||||
}
|
||||
|
||||
if ($value instanceof SafeDecorator) {
|
||||
// do not escape objects marked as safe
|
||||
// return the original object
|
||||
return $value->getValue();
|
||||
}
|
||||
|
||||
if (self::isClassMarkedAsSafe(get_class($value)) || $value instanceof SafeDecoratorInterface) {
|
||||
// the class or one of its children is marked as safe
|
||||
// return the unescaped object
|
||||
return $value;
|
||||
}
|
||||
|
||||
if ($value instanceof \Traversable) {
|
||||
return new IteratorDecorator($escaper, $value);
|
||||
}
|
||||
|
@ -16,7 +16,7 @@ namespace Symfony\Component\OutputEscaper;
|
||||
*
|
||||
* @author Fabien Potencier <fabien.potencier@symfony-project.com>
|
||||
*/
|
||||
class SafeDecorator extends \ArrayIterator
|
||||
class SafeDecorator extends \ArrayIterator implements SafeDecoratorInterface
|
||||
{
|
||||
protected $value;
|
||||
|
||||
|
@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
namespace Symfony\Component\OutputEscaper;
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien.potencier@symfony-project.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Marks a class as being safe for output.
|
||||
*
|
||||
* @author Fabien Potencier <fabien.potencier@symfony-project.com>
|
||||
*/
|
||||
interface SafeDecoratorInterface
|
||||
{
|
||||
}
|
Reference in New Issue
Block a user