[ Index ]

PHP Cross Reference of PHK Manager

title

Body

[close]

/PHK/Build/PSF/ -> CmdOptions.php (source)

   1  <?php
   2  //=============================================================================
   3  //
   4  // Copyright Francois Laupretre <phk@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  * @copyright Francois Laupretre <phk@tekwire.net>
  21  * @license http://www.apache.org/licenses/LICENSE-2.0 Apache License, V 2.0
  22  * @category PHK
  23  * @package PHK
  24  *///==========================================================================
  25  
  26  namespace PHK\Build\PSF {
  27  
  28  if (!class_exists('PHK\Build\PSF\CmdOptions',false))
  29  {
  30  
  31  //=============================================================================
  32  /**
  33  * This class manages options for lines in the first block of a PSF
  34  *
  35  * API status: Private
  36  * Included in the PHK PHP runtime: No
  37  * Implemented in the extension: No
  38  *///==========================================================================
  39  
  40  class CmdOptions extends \Phool\Options\Base
  41  {
  42  
  43  // Short/long modifier args
  44  
  45  protected $opt_modifiers=array(
  46      array('short' => 'a', 'long' => 'autoload'  , 'value' => false),
  47      array('short' => 'n', 'long' => 'no-autoload'  , 'value' => false),
  48      array('short' => 's', 'long' => 'strip'  , 'value' => false),
  49      array('short' => 'p', 'long' => 'plain'  , 'value' => false),
  50      array('short' => 'c', 'long' => 'compression'  , 'value' => true),
  51      array('short' => 't', 'long' => 'target-path'  , 'value' => true),
  52      array('short' => 'b', 'long' => 'target-base'  , 'value' => true),
  53      array('short' => 'C', 'long' => 'directory'  , 'value' => true)
  54      );
  55  
  56  // Option values
  57  
  58  protected $options=array(
  59      'autoload' => null,
  60      'strip' => null,
  61      'compression' => null,
  62      'target-path' => null,
  63      'target-base' => null,
  64      'directory' => null
  65      );
  66  
  67  //-----------------------
  68  
  69  protected function processOption($opt,$arg)
  70  {
  71  switch($opt)
  72      {
  73      case 'a':
  74          $this->options['autoload']=true;
  75          break;
  76  
  77      case 'n':
  78          $this->options['autoload']=false;
  79          break;
  80  
  81      case 's':
  82          $this->options['strip']=true;
  83          break;
  84  
  85      case 'p':
  86          $this->options['strip']=false;
  87          break;
  88  
  89      case 'c':
  90          $this->options['compression']=strtolower($arg);
  91          break;
  92  
  93      case 't':
  94          $this->options['target-path']=$arg;
  95          break;
  96  
  97      case 'b':
  98          $this->options['target-base']=$arg;
  99          break;
 100  
 101      case 'C':
 102          $this->options['directory']=$arg;
 103          break;
 104      }
 105  }
 106  
 107  //---
 108  } // End of class
 109  //===========================================================================
 110  } // End of class_exists
 111  //===========================================================================
 112  } // End of namespace
 113  //===========================================================================
 114  ?>


Generated: Thu Jun 4 18:33:15 2015 Cross-referenced by PHPXref 0.7.1