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

Source for file Exception.php

Documentation is available at Exception.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: Exception.php,v 1.5 2008/10/09 10:44:53 izi Exp $
  20.  * @link      http://pear.php.net/package/Console_CommandLine
  21.  * @since     File available since release 0.1.0
  22.  * @filesource
  23.  */
  24.  
  25. /**
  26.  * Include the PEAR_Exception class
  27.  */
  28. require_once 'PEAR/Exception.php';
  29.  
  30. /**
  31.  * Class for exceptions raised by the Console_CommandLine package.
  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: 1.0.6
  39.  * @link      http://pear.php.net/package/Console_CommandLine
  40.  * @since     Class available since release 0.1.0
  41.  */
  42. class Console_CommandLine_Exception extends PEAR_Exception
  43. {
  44.     // Codes constants {{{
  45.  
  46.     /**#@+
  47.      * Exception code constants.
  48.      */
  49.     const OPTION_VALUE_REQUIRED   = 1;
  50.     const OPTION_VALUE_UNEXPECTED = 2;
  51.     const OPTION_VALUE_TYPE_ERROR = 3;
  52.     const OPTION_UNKNOWN          = 4;
  53.     const ARGUMENT_REQUIRED       = 5;
  54.     /**#@-*/
  55.  
  56.     // }}}
  57.     // factory() {{{
  58.  
  59.     /**
  60.      * Convenience method that builds the exception with the array of params by
  61.      * calling the message provider class.
  62.      *
  63.      * @param string              $code   The string identifier of the exception
  64.      * @param array               $params Array of template vars/values
  65.      * @param Console_CommandLine $parser An instance of the parser
  66.      *
  67.      * @return object an instance of Console_CommandLine_Exception
  68.      */
  69.     public static function factory($code$params$parser)
  70.     {
  71.         $msg   $parser->message_provider->get($code$params);
  72.         $const 'Console_CommandLine_Exception::' $code;
  73.         $code  defined($constconstant($const: 0;
  74.         return new Console_CommandLine_Exception($msg$code);
  75.     }
  76.  
  77.     // }}}
  78. }

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