0
|
1 <?php
|
|
2
|
|
3 /* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
|
|
4
|
|
5 /**
|
|
6 * This file is part of the PEAR Console_CommandLine package.
|
|
7 *
|
|
8 * PHP version 5
|
|
9 *
|
|
10 * LICENSE: This source file is subject to the MIT license that is available
|
|
11 * through the world-wide-web at the following URI:
|
|
12 * http://opensource.org/licenses/mit-license.php
|
|
13 *
|
|
14 * @category Console
|
|
15 * @package Console_CommandLine
|
|
16 * @author David JEAN LOUIS <izimobil@gmail.com>
|
|
17 * @copyright 2007 David JEAN LOUIS
|
|
18 * @license http://opensource.org/licenses/mit-license.php MIT License
|
|
19 * @version CVS: $Id$
|
|
20 * @link http://pear.php.net/package/Console_CommandLine
|
|
21 * @since File available since release 0.1.0
|
|
22 * @filesource
|
|
23 */
|
|
24
|
|
25 /**
|
|
26 * The Outputter interface.
|
|
27 */
|
|
28 require_once 'Console/CommandLine/Outputter.php';
|
|
29
|
|
30 /**
|
|
31 * Console_CommandLine default Outputter.
|
|
32 *
|
|
33 * @category Console
|
|
34 * @package Console_CommandLine
|
|
35 * @author David JEAN LOUIS <izimobil@gmail.com>
|
|
36 * @copyright 2007 David JEAN LOUIS
|
|
37 * @license http://opensource.org/licenses/mit-license.php MIT License
|
|
38 * @version Release: @package_version@
|
|
39 * @link http://pear.php.net/package/Console_CommandLine
|
|
40 * @since Class available since release 0.1.0
|
|
41 */
|
|
42 class Console_CommandLine_Outputter_Default implements Console_CommandLine_Outputter
|
|
43 {
|
|
44 // stdout() {{{
|
|
45
|
|
46 /**
|
|
47 * Writes the message $msg to STDOUT.
|
|
48 *
|
|
49 * @param string $msg The message to output
|
|
50 *
|
|
51 * @return void
|
|
52 */
|
|
53 public function stdout($msg)
|
|
54 {
|
|
55 if (defined('STDOUT')) {
|
|
56 fwrite(STDOUT, $msg);
|
|
57 } else {
|
|
58 echo $msg;
|
|
59 }
|
|
60 }
|
|
61
|
|
62 // }}}
|
|
63 // stderr() {{{
|
|
64
|
|
65 /**
|
|
66 * Writes the message $msg to STDERR.
|
|
67 *
|
|
68 * @param string $msg The message to output
|
|
69 *
|
|
70 * @return void
|
|
71 */
|
|
72 public function stderr($msg)
|
|
73 {
|
|
74 if (defined('STDERR')) {
|
|
75 fwrite(STDERR, $msg);
|
|
76 } else {
|
|
77 echo $msg;
|
|
78 }
|
|
79 }
|
|
80
|
|
81 // }}}
|
|
82 }
|