Exemplo n.º 1
0
 public function headers()
 {
     $_SERVER = Helpers::htmlentitiesArray($_SERVER, true);
     foreach ($_SERVER as $key => $value) {
         $this->headers[$key] = $value;
     }
 }
Exemplo n.º 2
0
 public function testHtmlSpecialChars()
 {
     $singlestring = '<>&';
     $singlestringAnswer = '&lt;&gt;&amp;';
     $array = ['<>&', 'key<' => ['<>&', 'key<' => '<>&']];
     $arrayAnswersDoKeysTrue = ['&lt;&gt;&amp;', 'key&lt;' => ['&lt;&gt;&amp;', 'key&lt;' => '&lt;&gt;&amp;']];
     $arrayAnswersDoKeysFalse = ['&lt;&gt;&amp;', 'key<' => ['&lt;&gt;&amp;', 'key<' => '&lt;&gt;&amp;']];
     $this->assertEquals($singlestringAnswer, \RESTWork\Helpers::htmlspecialchars($singlestring));
     $this->assertEquals($arrayAnswersDoKeysFalse, \RESTWork\Helpers::htmlspecialcharsArray($array, false));
     $this->assertEquals($arrayAnswersDoKeysTrue, \RESTWork\Helpers::htmlspecialcharsArray($array, true));
 }