[ Index ]

PHP Cross Reference of phool

title

Body

[close]

/Phool/Options/ -> Dummy.php (source)

   1  <?php
   2  //=============================================================================
   3  //
   4  // Copyright Francois Laupretre <automap@tekwire.net>
   5  //
   6  //   Licensed under the Apache License, Version 2.0 (the "License");
   7  //   you may not use this file except in compliance with the License.
   8  //   You may obtain a copy of the License at
   9  //
  10  //       http://www.apache.org/licenses/LICENSE-2.0
  11  //
  12  //   Unless required by applicable law or agreed to in writing, software
  13  //   distributed under the License is distributed on an "AS IS" BASIS,
  14  //   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  15  //   See the License for the specific language governing permissions and
  16  //   limitations under the License.
  17  //
  18  //=============================================================================
  19  /**
  20  * This class is an example of an options parser
  21  *
  22  * @copyright Francois Laupretre <phool@tekwire.net>
  23  * @license http://www.apache.org/licenses/LICENSE-2.0 Apache License, V 2.0
  24  * @category phool
  25  * @package phool
  26  */
  27  // <Automap>:ignore-file
  28  //============================================================================
  29  
  30  class Dummy_Options extends \Phool\Options\Base
  31  {
  32  
  33  // Short/long modifier args
  34  
  35  protected $opt_modifiers=array(
  36      array('short' => 'v', 'long' => 'verbose', 'value' => false),
  37      array('short' => 'q', 'long' => 'quiet'  , 'value' => false),
  38      array('short' => 'd', 'long' => 'dummy'  , 'value' => true)
  39      );
  40  
  41  // Option values
  42  
  43  protected $options=array(
  44      'dummy_opt' => 'default_value'
  45      );
  46  
  47  //-----------------------
  48  // Option is always provided in short form
  49  
  50  protected function processOption($opt,$arg)
  51  {
  52  switch($opt)
  53      {
  54      case 'v':
  55          \Phool\Display::incVerbose();
  56          break;
  57  
  58      case 'q':
  59          \Phool\Display::decVerbose();
  60          break;
  61  
  62      case 'm':
  63          $this->$options['dummy_opt']=$arg;
  64          break;
  65      }
  66  }
  67  
  68  //---------
  69  
  70  //============================================================================
  71  } // End of class
  72  ?>


Generated: Thu Jun 4 19:17:11 2015 Cross-referenced by PHPXref 0.7.1