@@ -408,53 +408,67 @@ public static function writeHelpCommand($command = "") {
408408 }
409409
410410 /**
411- * Write out a line to the console
412- * @param {String} the content to be written out
413- * @param {Boolean} if there should be two spaces added to the beginning of the line
414- * @param {Boolean} if there should be two breaks added to the end of the line
411+ * Make sure the space is properly set between long command options and short command options
412+ * @param {Integer} the longest length of the command's options
413+ * @param {Integer} the character length of the given option
415414 */
416- public static function writeLine ($ line ,$ doubleSpace = false ,$ doubleBreak = false ) {
417- $ break = ($ doubleBreak ) ? PHP_EOL .PHP_EOL : PHP_EOL ;
418- if (strpos ($ line ,"<nophpeol> " ) !== false ) {
419- $ break = "" ;
420- $ line = str_replace ("<nophpeol> " ,"" ,$ line );
415+ public static function getSpacer ($ lengthLong ,$ itemLongLength ) {
416+ $ i = 0 ;
417+ $ spacer = " " ;
418+ $ spacerLength = $ lengthLong - $ itemLongLength ;
419+ while ($ i < $ spacerLength ) {
420+ $ spacer .= " " ;
421+ $ i ++;
421422 }
422- $ space = ($ doubleSpace ) ? " " : "" ;
423- $ c = self ::$ color ;
424- print $ space .$ c ($ line )->colorize ().$ break ;
423+ return $ spacer ;
425424 }
426425
427426 /**
428- * Write out a line to the console with info tags
427+ * Modify a line to include the given tag by default
428+ * @param {String} the content to be written out
429+ */
430+ public static function addTags ($ line ,$ tag ) {
431+ $ lineFinal = "< " .$ tag ."> " .preg_replace ("/<[A-z0-9-_]{1,}>[^<]{1,}<\/[A-z0-9-_]{1,}>/ " ,"</ " .$ tag .">$0< " .$ tag ."> " ,$ line )."</ " .$ tag ."> " ;
432+ return $ lineFinal ;
433+ }
434+
435+ /**
436+ * Write out a line to the console with error tags
429437 * @param {String} the content to be written out
430438 * @param {Boolean} if there should be two spaces added to the beginning of the line
431439 * @param {Boolean} if there should be two breaks added to the end of the line
432440 */
433- public static function writeInfo ($ line ,$ doubleSpace = false ,$ doubleBreak = false ) {
434- $ lineFinal = self ::addTags ($ line ,"info " );
441+ public static function writeError ($ line ,$ doubleSpace = false ,$ doubleBreak = false ) {
442+ $ lineFinal = self ::addTags ($ line ,"error " );
435443 self ::writeLine ($ lineFinal ,$ doubleSpace ,$ doubleBreak );
436444 }
437445
438446 /**
439- * Write out a line to the console with warning tags
447+ * Write out a line to the console with info tags
440448 * @param {String} the content to be written out
441449 * @param {Boolean} if there should be two spaces added to the beginning of the line
442450 * @param {Boolean} if there should be two breaks added to the end of the line
443451 */
444- public static function writeWarning ($ line ,$ doubleSpace = false ,$ doubleBreak = false ) {
445- $ lineFinal = self ::addTags ($ line ,"warning " );
452+ public static function writeInfo ($ line ,$ doubleSpace = false ,$ doubleBreak = false ) {
453+ $ lineFinal = self ::addTags ($ line ,"info " );
446454 self ::writeLine ($ lineFinal ,$ doubleSpace ,$ doubleBreak );
447455 }
448456
449457 /**
450- * Write out a line to the console with error tags
458+ * Write out a line to the console
451459 * @param {String} the content to be written out
452460 * @param {Boolean} if there should be two spaces added to the beginning of the line
453461 * @param {Boolean} if there should be two breaks added to the end of the line
454462 */
455- public static function writeError ($ line ,$ doubleSpace = false ,$ doubleBreak = false ) {
456- $ lineFinal = self ::addTags ($ line ,"error " );
457- self ::writeLine ($ lineFinal ,$ doubleSpace ,$ doubleBreak );
463+ public static function writeLine ($ line ,$ doubleSpace = false ,$ doubleBreak = false ) {
464+ $ break = ($ doubleBreak ) ? PHP_EOL .PHP_EOL : PHP_EOL ;
465+ if (strpos ($ line ,"<nophpeol> " ) !== false ) {
466+ $ break = "" ;
467+ $ line = str_replace ("<nophpeol> " ,"" ,$ line );
468+ }
469+ $ space = ($ doubleSpace ) ? " " : "" ;
470+ $ c = self ::$ color ;
471+ print $ space .$ c ($ line )->colorize ().$ break ;
458472 }
459473
460474 /**
@@ -469,30 +483,15 @@ public static function writeTag($tag,$line,$doubleSpace = false,$doubleBreak = f
469483 self ::writeLine ($ lineFinal ,$ doubleSpace ,$ doubleBreak );
470484 }
471485
472-
473486 /**
474- * Modify a line to include the given tag by default
487+ * Write out a line to the console with warning tags
475488 * @param {String} the content to be written out
489+ * @param {Boolean} if there should be two spaces added to the beginning of the line
490+ * @param {Boolean} if there should be two breaks added to the end of the line
476491 */
477- public static function addTags ($ line ,$ tag ) {
478- $ lineFinal = "< " .$ tag ."> " .preg_replace ("/<[A-z0-9-_]{1,}>[^<]{1,}<\/[A-z0-9-_]{1,}>/ " ,"</ " .$ tag .">$0< " .$ tag ."> " ,$ line )."</ " .$ tag ."> " ;
479- return $ lineFinal ;
480- }
481-
482- /**
483- * Make sure the space is properly set between long command options and short command options
484- * @param {Integer} the longest length of the command's options
485- * @param {Integer} the character length of the given option
486- */
487- public static function getSpacer ($ lengthLong ,$ itemLongLength ) {
488- $ i = 0 ;
489- $ spacer = " " ;
490- $ spacerLength = $ lengthLong - $ itemLongLength ;
491- while ($ i < $ spacerLength ) {
492- $ spacer .= " " ;
493- $ i ++;
494- }
495- return $ spacer ;
492+ public static function writeWarning ($ line ,$ doubleSpace = false ,$ doubleBreak = false ) {
493+ $ lineFinal = self ::addTags ($ line ,"warning " );
494+ self ::writeLine ($ lineFinal ,$ doubleSpace ,$ doubleBreak );
496495 }
497496
498497}
0 commit comments