Permalink
Browse files

Changing default command header output style.

Lines will now by default be the same width as the provided text.
Updating dockblock.
Adding example to docblock.
  • Loading branch information...
1 parent dc68018 commit 8564937e3ec3d53aa6dd8b3758d3ae16c57d6911 @davidpersson davidpersson committed May 17, 2012
Showing with 16 additions and 4 deletions.
  1. +16 −4 console/Command.php
View
@@ -218,15 +218,27 @@ public function in($prompt = null, array $options = array()) {
}
/**
- * Writes a header to the output stream.
+ * Writes a header to the output stream. In addition to the actual text,
+ * horizontal lines before and afterwards are written. The lines will have
+ * the same length as the text. This behavior can be modified by providing
+ * the length of lines as a second paramerter.
*
- * In addition to the actual text, horizontal lines before and afterwards are written.
+ * Given the text `'Lithium'` this generates following output:
+ *
+ * {{{
+ * -------
+ * Lihtium
+ * -------
+ * }}}
*
* @param string $text The heading text.
- * @param integer $line The length of the line. Defaults to 80.
+ * @param integer $line The length of the line. Defaults to the length of text.
* @return void
*/
- public function header($text, $line = 80) {
+ public function header($text, $line = null) {
+ if (!$line) {
+ $line = strlen($text);
+ }
$this->hr($line);
$this->out($text, 1, 'heading');
$this->hr($line);

0 comments on commit 8564937

Please sign in to comment.