Skip to content

Commit

Permalink
Remove static functions
Browse files Browse the repository at this point in the history
  • Loading branch information
pgaultier committed Jul 4, 2014
1 parent be2d553 commit 9d25418
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions framework/filters/Cors.php
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ public function extractHeaders($request)
$headers = [];
$requestHeaders = array_keys($this->cors);
foreach ($requestHeaders as $headerField) {
$serverField = static::headerizeToPhp($headerField);
$serverField = $this->headerizeToPhp($headerField);
$headerData = isset($_SERVER[$serverField])?$_SERVER[$serverField]:null;
if ($headerData !== null) {
$headers[$headerField] = $headerData;
Expand Down Expand Up @@ -182,7 +182,7 @@ protected function prepareAllowHeaders($type, $requestHeaders, &$responseHeaders
if ($type === 'Method') {
$responseHeaders[$responseHeaderField] = strtoupper($requestHeaders[$requestHeaderField]);
} elseif ($type === 'Headers') {
$responseHeaders[$responseHeaderField] = static::headerize($requestHeaders[$requestHeaderField]);
$responseHeaders[$responseHeaderField] = $this->headerize($requestHeaders[$requestHeaderField]);
}
} else {
$requestedData = preg_split("/[\s,]+/", $requestHeaders[$requestHeaderField], -1, PREG_SPLIT_NO_EMPTY);
Expand All @@ -191,7 +191,7 @@ protected function prepareAllowHeaders($type, $requestHeaders, &$responseHeaders
if ($type === 'Method') {
$req = strtoupper($req);
} elseif ($type === 'Headers') {
$req = static::headerize($req);
$req = $this->headerize($req);
}
if (in_array($req, $this->cors[$requestHeaderField])) {
$acceptedData[] = $req;
Expand Down Expand Up @@ -226,7 +226,7 @@ public function addCorsHeaders($response, $headers)
* @param string $string string to convert
* @return string the result in "header" format
*/
protected static function headerize($string)
protected function headerize($string)
{
$headers = preg_split("/[\s,]+/", $string, -1, PREG_SPLIT_NO_EMPTY);
$headers = array_map(function($element) {
Expand All @@ -242,7 +242,7 @@ protected static function headerize($string)
* @param string $string string to convert
* @return string the result in "php $_SERVER header" format
*/
protected static function headerizeToPhp($string)
protected function headerizeToPhp($string)
{
return 'HTTP_'.strtoupper(str_replace([' ', '-'], ['_', '_'], $string));
}
Expand Down

0 comments on commit 9d25418

Please sign in to comment.