From aed8d933745e84ec7d1983c813a94a0a762e6f44 Mon Sep 17 00:00:00 2001 From: jrfnl Date: Mon, 4 Nov 2024 00:55:28 +0100 Subject: [PATCH] Generators/Text::printTitle(): minor tweaks Just removing some duplicate function calls. --- src/Generators/Text.php | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/Generators/Text.php b/src/Generators/Text.php index ce419ba118..419bcc3d56 100644 --- a/src/Generators/Text.php +++ b/src/Generators/Text.php @@ -5,7 +5,9 @@ * Output is designed to be displayed in a terminal and is wrapped to 100 characters. * * @author Greg Sherwood + * @author Juliette Reinders Folmer * @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 */ @@ -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()