1<?php 2class gtOptionalSections { 3 4 private $optSections = array( 5 'skipif' => false, 6 'ini' => false, 7 'clean' => false, 8 'done' => false, 9 ); 10 11 private $skipifKey = ''; 12 private $skipifExt = ''; 13 14 15 public function setOptions($commandLineOptions) { 16 if($commandLineOptions->hasOption('s')) { 17 $options = explode(':', $commandLineOptions->getOption('s')); 18 19 foreach($options as $option) { 20 21 if(array_key_exists($option, $this->optSections )) { 22 $this->optSections[$option] = true; 23 } else { 24 throw new gtUnknownSectionException('Unrecognised optional section'); 25 } 26 } 27 28 if($commandLineOptions->hasOption('k')) { 29 $this->skipifKey = $commandLineOptions->getOption('k'); 30 } 31 32 if($commandLineOptions->hasOption('x')) { 33 $this->skipifExt = $commandLineOptions->getOption('x'); 34 } 35 36 } 37 } 38 39 40 41 public function getOptions() { 42 return $this->optSections; 43 } 44 45 46 public function getSkipifKey() { 47 return $this->skipifKey; 48 } 49 50 public function getSkipifExt() { 51 return $this->skipifExt; 52 } 53 54 public function hasSkipif() { 55 return $this->optSections['skipif']; 56 } 57 58 public function hasSkipifKey() { 59 if($this->skipifKey != '') { 60 return true; 61 } 62 return false; 63 } 64 65 public function hasSkipifExt() { 66 if($this->skipifExt != '') { 67 return true; 68 } 69 return false; 70 } 71 public function hasIni() { 72 return $this->optSections['ini']; 73 } 74 75 public function hasClean() { 76 return $this->optSections['clean']; 77 } 78 79 public function hasDone() { 80 return $this->optSections['done']; 81 } 82 83 84} 85?>