Skip to content

Generators/Text::printTitle(): minor tweaks #724

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 27, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions src/Generators/Text.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@
* Output is designed to be displayed in a terminal and is wrapped to 100 characters.
*
* @author Greg Sherwood <gsherwood@squiz.net>
* @author Juliette Reinders Folmer <phpcs_nospam@adviesenzo.nl>
* @copyright 2006-2015 Squiz Pty Ltd (ABN 77 084 670 600)
* @copyright 2024 PHPCSStandards and contributors
* @license https://github.com/PHPCSStandards/PHP_CodeSniffer/blob/master/licence.txt BSD Licence
*/

Expand Down Expand Up @@ -52,13 +54,15 @@ public function processSniff(DOMNode $doc)
*/
protected function printTitle(DOMNode $doc)
{
$title = $this->getTitle($doc);
$standard = $this->ruleset->name;
$title = $this->getTitle($doc);
$standard = $this->ruleset->name;
$displayTitle = "$standard CODING STANDARD: $title";
$titleLength = strlen($displayTitle);

echo PHP_EOL;
echo str_repeat('-', (strlen("$standard CODING STANDARD: $title") + 4));
echo strtoupper(PHP_EOL."| $standard CODING STANDARD: $title |".PHP_EOL);
echo str_repeat('-', (strlen("$standard CODING STANDARD: $title") + 4));
echo str_repeat('-', ($titleLength + 4));
echo strtoupper(PHP_EOL."| $displayTitle |".PHP_EOL);
echo str_repeat('-', ($titleLength + 4));
echo PHP_EOL.PHP_EOL;

}//end printTitle()
Expand Down