@@ -312,28 +312,45 @@ public static function getInstalledStandardPath($standard)
312
312
313
313
314
314
/**
315
- * Prints out a list of installed coding standards.
315
+ * Prepares a list of installed coding standards for display .
316
316
*
317
- * @return void
317
+ * @return string
318
318
*/
319
- public static function printInstalledStandards ()
319
+ public static function prepareInstalledStandardsForDisplay ()
320
320
{
321
321
$ installedStandards = self ::getInstalledStandards ();
322
322
$ numStandards = count ($ installedStandards );
323
323
324
+ $ output = '' ;
324
325
if ($ numStandards === 0 ) {
325
- echo 'No coding standards are installed. ' . PHP_EOL ;
326
+ $ output .= 'No coding standards are installed. ' ;
326
327
} else {
327
328
$ lastStandard = array_pop ($ installedStandards );
328
329
if ($ numStandards === 1 ) {
329
- echo "The only coding standard installed is $ lastStandard " . PHP_EOL ;
330
+ $ output .= "The only coding standard installed is $ lastStandard " ;
330
331
} else {
331
332
$ standardList = implode (', ' , $ installedStandards );
332
333
$ standardList .= ' and ' .$ lastStandard ;
333
- echo 'The installed coding standards are ' .$ standardList. PHP_EOL ;
334
+ $ output .= 'The installed coding standards are ' .$ standardList ;
334
335
}
335
336
}
336
337
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
+
337
354
}//end printInstalledStandards()
338
355
339
356
0 commit comments