Skip to content

Commit 84d0a5f

Browse files
committed
Generators/HTML::getFormattedHeader(): minor simplification
Use a single call to `sprintf()` instead of lots of string concatenation.
1 parent f117c2b commit 84d0a5f

File tree

1 file changed

+14
-9
lines changed

1 file changed

+14
-9
lines changed

src/Generators/HTML.php

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -149,15 +149,20 @@ protected function printHeader()
149149
protected function getFormattedHeader()
150150
{
151151
$standard = $this->ruleset->name;
152-
$output = '<html>'.PHP_EOL;
153-
$output .= ' <head>'.PHP_EOL;
154-
$output .= " <title>$standard Coding Standards</title>".PHP_EOL;
155-
$output .= ' '.str_replace("\n", PHP_EOL, self::STYLESHEET).PHP_EOL;
156-
$output .= ' </head>'.PHP_EOL;
157-
$output .= ' <body>'.PHP_EOL;
158-
$output .= " <h1>$standard Coding Standards</h1>".PHP_EOL;
159-
160-
return $output;
152+
$output = sprintf(
153+
'<html>
154+
<head>
155+
<title>%1$s Coding Standards</title>
156+
%2$s
157+
</head>
158+
<body>
159+
<h1>%1$s Coding Standards</h1>',
160+
$standard,
161+
self::STYLESHEET
162+
);
163+
164+
// Use the correct line endings based on the OS.
165+
return str_replace("\n", PHP_EOL, $output).PHP_EOL;
161166

162167
}//end getFormattedHeader()
163168

0 commit comments

Comments
 (0)