Back to index

php5  5.3.10
gtOptionalSections.php
Go to the documentation of this file.
00001 <?php
00002 class gtOptionalSections {
00003 
00004   private $optSections = array(
00005     'skipif' => false,
00006     'ini'    => false,
00007     'clean'  => false,
00008     'done'   => false,
00009   );
00010 
00011   private $skipifKey = '';
00012   private $skipifExt = '';
00013 
00014 
00015   public function setOptions($commandLineOptions) {
00016     if($commandLineOptions->hasOption('s')) {
00017       $options = explode(':', $commandLineOptions->getOption('s'));
00018 
00019       foreach($options as $option) {
00020 
00021         if(array_key_exists($option, $this->optSections )) {
00022           $this->optSections[$option] = true;
00023         } else {
00024           throw new gtUnknownSectionException('Unrecognised optional section');
00025         }
00026       }
00027 
00028       if($commandLineOptions->hasOption('k')) {
00029         $this->skipifKey = $commandLineOptions->getOption('k');
00030       }
00031       
00032       if($commandLineOptions->hasOption('x')) {
00033         $this->skipifExt = $commandLineOptions->getOption('x');
00034       }
00035       
00036     }
00037   }
00038 
00039 
00040 
00041   public function getOptions() {
00042     return $this->optSections;
00043   }
00044 
00045 
00046   public function getSkipifKey() {
00047     return $this->skipifKey;
00048   }
00049   
00050   public function getSkipifExt() {
00051     return $this->skipifExt;
00052   }
00053 
00054   public function hasSkipif() {
00055     return $this->optSections['skipif'];
00056   }
00057 
00058   public function hasSkipifKey() {
00059     if($this->skipifKey != '') {
00060       return true;
00061     }
00062     return false;
00063   }
00064   
00065   public function hasSkipifExt() {
00066     if($this->skipifExt != '') {
00067       return true;
00068     }
00069     return false;
00070   }
00071   public function hasIni() {
00072     return $this->optSections['ini'];
00073   }
00074 
00075   public function hasClean() {
00076     return $this->optSections['clean'];
00077   }
00078   
00079   public function hasDone() {
00080     return $this->optSections['done'];
00081   }
00082 
00083 
00084 }
00085 ?>