Console_CommandLine
[ class tree: Console_CommandLine ] [ index: Console_CommandLine ] [ all elements ]

Source for file List.php

Documentation is available at List.php

  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.  * Required by this class.
  27.  */
  28. require_once 'Console/CommandLine/Action.php';
  29.  
  30. /**
  31.  * Class that represent the List action, a special action that simply output an
  32.  * array as a list.
  33.  *
  34.  * @category  Console
  35.  * @package   Console_CommandLine
  36.  * @author    David JEAN LOUIS <izimobil@gmail.com>
  37.  * @copyright 2007 David JEAN LOUIS
  38.  * @license   http://opensource.org/licenses/mit-license.php MIT License
  39.  * @version   Release: 1.2.0
  40.  * @link      http://pear.php.net/package/Console_CommandLine
  41.  * @since     Class available since release 0.1.0
  42.  */
  43. {
  44.     // execute() {{{
  45.  
  46.     /**
  47.      * Executes the action with the value entered by the user.
  48.      * Possible parameters are:
  49.      * - message: an alternative message to display instead of the default
  50.      *   message,
  51.      * - delimiter: an alternative delimiter instead of the comma,
  52.      * - post: a string to append after the message (default is the new line
  53.      *   char).
  54.      *
  55.      * @param mixed $value  The option value
  56.      * @param array $params An optional array of parameters
  57.      *
  58.      * @return string 
  59.      */
  60.     public function execute($value = false$params = array())
  61.     {
  62.         $list = isset($params['list']$params['list': array();
  63.         $msg  = isset($params['message']
  64.             ? $params['message'
  65.             : $this->parser->message_provider->get('LIST_DISPLAYED_MESSAGE');
  66.         $del  = isset($params['delimiter']$params['delimiter'', ';
  67.         $post = isset($params['post']$params['post'"\n";
  68.         $this->parser->outputter->stdout($msg implode($del$list$post);
  69.         exit(0);
  70.     }
  71.     // }}}
  72. }

Documentation generated on Mon, 11 Mar 2019 15:51:32 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.