@@ -312,28 +312,45 @@ public static function getInstalledStandardPath($standard)
312312
313313
314314 /**
315- * Prints out a list of installed coding standards.
315+ * Prepares a list of installed coding standards for display .
316316 *
317- * @return void
317+ * @return string
318318 */
319- public static function printInstalledStandards ()
319+ public static function prepareInstalledStandardsForDisplay ()
320320 {
321321 $ installedStandards = self ::getInstalledStandards ();
322322 $ numStandards = count ($ installedStandards );
323323
324+ $ output = '' ;
324325 if ($ numStandards === 0 ) {
325- echo 'No coding standards are installed. ' . PHP_EOL ;
326+ $ output .= 'No coding standards are installed. ' ;
326327 } else {
327328 $ lastStandard = array_pop ($ installedStandards );
328329 if ($ numStandards === 1 ) {
329- echo "The only coding standard installed is $ lastStandard " . PHP_EOL ;
330+ $ output .= "The only coding standard installed is $ lastStandard " ;
330331 } else {
331332 $ standardList = implode (', ' , $ installedStandards );
332333 $ standardList .= ' and ' .$ lastStandard ;
333- echo 'The installed coding standards are ' .$ standardList. PHP_EOL ;
334+ $ output .= 'The installed coding standards are ' .$ standardList ;
334335 }
335336 }
336337
338+ return $ output ;
339+
340+ }//end prepareInstalledStandardsForDisplay()
341+
342+
343+ /**
344+ * Prints out a list of installed coding standards.
345+ *
346+ * @deprecated 4.0.0 Use `echo Standards::prepareInstalledStandardsForDisplay()` instead.
347+ *
348+ * @return void
349+ */
350+ public static function printInstalledStandards ()
351+ {
352+ echo self ::prepareInstalledStandardsForDisplay (), PHP_EOL ;
353+
337354 }//end printInstalledStandards()
338355
339356
0 commit comments