Ejemplo n.º 1
0
 /**
  * @test
  */
 public function arrayIsEscaped()
 {
     $obj = new stdClass();
     $obj->foo = '_foo<';
     $obj->bar = '_bar>';
     $data = ['foo<' => ['foo\''], 'bar' => $obj, 'baz&', 'zaz' => null, 'vaz' => '11"'];
     $this->assertSame(['foo<' => ['foo&#039;'], 'bar' => ['foo' => '_foo&lt;', 'bar' => '_bar&gt;'], 'baz&amp;', 'zaz' => null, 'vaz' => '11&quot;'], Escaper::escape($data));
 }
 /**
  * @param array             $app
  * @param ResponseHeaderBag $headers
  */
 private function setPageDataIfExists(array $app, ResponseHeaderBag $headers)
 {
     if (isset($app[Headers::PAGE_DATA_KEY])) {
         $headers->set(Headers::PAGE_DATA_HEADER, json_encode(Escaper::escape($app[Headers::PAGE_DATA_KEY])));
     }
 }