Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit e8119ce

Browse files
committed
[OutputEscaper] renamed Safe to SafeDecorator
1 parent 9738f34 commit e8119ce

File tree

4 files changed

+12
-12
lines changed

4 files changed

+12
-12
lines changed

src/Symfony/Components/OutputEscaper/Escaper.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ static public function escape($escaper, $value)
133133
// return the unescaped object
134134
return $value;
135135
}
136-
elseif ($value instanceof Safe)
136+
elseif ($value instanceof SafeDecorator)
137137
{
138138
// do not escape objects marked as safe
139139
// return the original object

src/Symfony/Components/OutputEscaper/Safe.php renamed to src/Symfony/Components/OutputEscaper/SafeDecorator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
* @subpackage output_escaper
1919
* @author Fabien Potencier <[email protected]>
2020
*/
21-
class Safe extends \ArrayIterator
21+
class SafeDecorator extends \ArrayIterator
2222
{
2323
protected $value;
2424

tests/unit/Symfony/Components/OutputEscaper/EscaperTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
require_once __DIR__.'/../../../bootstrap.php';
1313

1414
use Symfony\Components\OutputEscaper\Escaper;
15-
use Symfony\Components\OutputEscaper\Safe;
15+
use Symfony\Components\OutputEscaper\SafeDecorator;
1616
use Symfony\Components\OutputEscaper\IteratorDecorator;
1717
use Symfony\Components\OutputEscaper\ArrayDecorator;
1818
use Symfony\Components\OutputEscaper\ObjectDecorator;
@@ -78,7 +78,7 @@ class OutputEscaperTestClassChild extends OutputEscaperTestClass
7878
$t->ok(Escaper::escape('entities', new \DirectoryIterator('.')) instanceof IteratorDecorator, '::escape() returns a IteratorDecorator object if the value to escape is an object that implements the ArrayAccess interface');
7979

8080
$t->diag('::escape() does not escape object marked as being safe');
81-
$t->ok(Escaper::escape('entities', new Safe(new OutputEscaperTestClass())) instanceof OutputEscaperTestClass, '::escape() returns the original value if it is marked as being safe');
81+
$t->ok(Escaper::escape('entities', new SafeDecorator(new OutputEscaperTestClass())) instanceof OutputEscaperTestClass, '::escape() returns the original value if it is marked as being safe');
8282

8383
Escaper::markClassAsSafe('OutputEscaperTestClass');
8484
$t->ok(Escaper::escape('entities', new OutputEscaperTestClass()) instanceof OutputEscaperTestClass, '::escape() returns the original value if the object class is marked as being safe');
@@ -129,7 +129,7 @@ class OutputEscaperTestClassChild extends OutputEscaperTestClass
129129
$t->ok(IteratorDecorator::unescape(Escaper::escape('entities', new DirectoryIterator('.'))) instanceof DirectoryIterator, '::unescape() unescapes IteratorDecorator objects');
130130

131131
$t->diag('::unescape() does not unescape object marked as being safe');
132-
$t->ok(Escaper::unescape(Escaper::escape('entities', new Safe(new OutputEscaperTestClass()))) instanceof OutputEscaperTestClass, '::unescape() returns the original value if it is marked as being safe');
132+
$t->ok(Escaper::unescape(Escaper::escape('entities', new SafeDecorator(new OutputEscaperTestClass()))) instanceof OutputEscaperTestClass, '::unescape() returns the original value if it is marked as being safe');
133133

134134
Escaper::markClassAsSafe('OutputEscaperTestClass');
135135
$t->ok(Escaper::unescape(Escaper::escape('entities', new OutputEscaperTestClass())) instanceof OutputEscaperTestClass, '::unescape() returns the original value if the object class is marked as being safe');

tests/unit/Symfony/Components/OutputEscaper/SafeTest.php renamed to tests/unit/Symfony/Components/OutputEscaper/SafeDecoratorTest.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,13 @@
1111

1212
require_once __DIR__.'/../../../bootstrap.php';
1313

14-
use Symfony\Components\OutputEscaper\Safe;
14+
use Symfony\Components\OutputEscaper\SafeDecorator;
1515

1616
$t = new LimeTest(13);
1717

1818
// ->getValue()
1919
$t->diag('->getValue()');
20-
$safe = new Safe('foo');
20+
$safe = new SafeDecorator('foo');
2121
$t->is($safe->getValue(), 'foo', '->getValue() returns the embedded value');
2222

2323
// ->__set() ->__get()
@@ -28,7 +28,7 @@ class TestClass1
2828
public $foo = 'bar';
2929
}
3030

31-
$safe = new Safe(new TestClass1());
31+
$safe = new SafeDecorator(new TestClass1());
3232

3333
$t->is($safe->foo, 'bar', '->__get() returns the object parameter');
3434
$safe->foo = 'baz';
@@ -45,7 +45,7 @@ public function doSomething()
4545
}
4646
}
4747

48-
$safe = new Safe(new TestClass2());
48+
$safe = new SafeDecorator(new TestClass2());
4949
$t->is($safe->doSomething(), 'ok', '->__call() invokes the embedded method');
5050

5151
// ->__isset() ->__unset()
@@ -58,7 +58,7 @@ class TestClass3
5858
$nullValue = null;
5959
}
6060

61-
$safe = new Safe(new TestClass3());
61+
$safe = new SafeDecorator(new TestClass3());
6262

6363
$t->is(isset($safe->boolValue), true, '->__isset() returns true if the property is not null');
6464
$t->is(isset($safe->nullValue), false, '->__isset() returns false if the property is null');
@@ -73,7 +73,7 @@ class TestClass3
7373
$input = array('one' => 1, 'two' => 2, 'three' => 3, 'children' => array(1, 2, 3));
7474
$output = array();
7575

76-
$safe = new Safe($input);
76+
$safe = new SafeDecorator($input);
7777
foreach ($safe as $key => $value)
7878
{
7979
$output[$key] = $value;
@@ -83,7 +83,7 @@ class TestClass3
8383
// ArrayAccess
8484
$t->diag('ArrayAccess');
8585

86-
$safe = new Safe(array('foo' => 'bar'));
86+
$safe = new SafeDecorator(array('foo' => 'bar'));
8787

8888
$t->is($safe['foo'], 'bar', '"ArrayAccess" implementation returns a value from the embedded array');
8989
$safe['foo'] = 'baz';

0 commit comments

Comments
 (0)