Skip to content

Commit

Permalink
favour built in function over regex
Browse files Browse the repository at this point in the history
  • Loading branch information
aidantwoods committed Dec 10, 2016
1 parent f44fafb commit 02ea7a6
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions SecureHeaders.php
Original file line number Diff line number Diff line change
Expand Up @@ -1049,13 +1049,9 @@ private function validate_headers()
{
foreach ($this->headers as $header => $data)
{
$friendly_header = preg_replace_callback(
'/(?:^|-)([a-z])/',
function($match){
return ' '.strtoupper($match[1]);
},
$header
);
$friendly_header = str_replace('-', ' ', $header);
$friendly_header = ucwords($friendly_header);

if (
$header === 'content-security-policy'
or $header === 'content-security-policy-report-only'
Expand Down

0 comments on commit 02ea7a6

Please sign in to comment.