Back to index

php5  5.3.10
gtTestSubject.php
Go to the documentation of this file.
00001 <?php
00002 abstract class gtTestSubject {
00003 
00004   protected $optionalArgumentNames;
00005   protected $mandatoryArgumentNames;
00006 
00007   protected $extraArgumentList = '';
00008   protected $shortArgumentList = '';
00009 
00010   protected $allowedArgumentLists;
00011 
00012   protected $maximumArgumentList;
00013   
00014   protected $initialisationStatements;
00015 
00016 
00021   public function getMandatoryArgumentNames() {
00022     return $this->mandatoryArgumentNames;
00023   }
00024 
00025 
00031   public function getOptionalArgumentNames() {
00032     return $this->optionalArgumentNames;
00033   }
00034   
00035   public function setArgumentLists() {
00036     $this->setValidArgumentLists();
00037     $this->setExtraArgumentList();
00038     $this->setShortArgumentList();
00039   }
00040 
00045   public function setExtraArgumentList() {
00046     if(count ($this->mandatoryArgumentNames) > 0) {
00047       for( $i = 0; $i < count( $this->mandatoryArgumentNames ); $i++) {
00048         $this->extraArgumentList .= "\$".$this->mandatoryArgumentNames[$i].", ";
00049       }
00050     }
00051      
00052     if(count ($this->optionalArgumentNames) > 0) {
00053       for( $i = 0; $i < count( $this->optionalArgumentNames ); $i++) {
00054         $this->extraArgumentList .=  "\$".$this->optionalArgumentNames[$i].", ";
00055       }
00056     }
00057 
00058     $this->extraArgumentList= $this->extraArgumentList. "\$extra_arg";
00059   }
00060    
00061 
00067   public function getExtraArgumentList() {
00068     return $this->extraArgumentList;
00069   }
00070 
00071 
00076   public function setShortArgumentList() {
00077 
00078     if(count ($this->mandatoryArgumentNames) > 0) {
00079       for( $i = 0; $i < count( $this->mandatoryArgumentNames ) - 1; $i++) {
00080         $this->shortArgumentList .= "\$".$this->mandatoryArgumentNames[$i].", ";
00081       }
00082       $this->shortArgumentList = substr($this->shortArgumentList, 0, -2);
00083     }
00084   }
00085 
00086 
00092   public function getShortArgumentList() {
00093     return $this->shortArgumentList;
00094   }
00095 
00096 
00101   public function setValidArgumentLists() {
00102     $this->allowedArgumentLists[0] = '';
00103     if(count ($this->mandatoryArgumentNames) > 0) {
00104       for( $i = 0; $i < count( $this->mandatoryArgumentNames ); $i++) {
00105         $this->allowedArgumentLists[0] .= "\$".$this->mandatoryArgumentNames[$i].", ";
00106       }
00107     }
00108      
00109     if(count ($this->optionalArgumentNames) > 0) {
00110       for( $i = 0; $i < count( $this->optionalArgumentNames ); $i++) {
00111         $this->allowedArgumentLists[] = $this->allowedArgumentLists[$i]."\$".$this->optionalArgumentNames[$i].", ";
00112         $this->allowedArgumentLists[$i] = substr ($this->allowedArgumentLists[$i], 0, -2);
00113       }
00114     }
00115 
00116     $this->allowedArgumentLists[count($this->allowedArgumentLists) -1 ] = substr($this->allowedArgumentLists[count($this->allowedArgumentLists) -1 ], 0, -2);
00117   }
00118 
00119 
00125   public function getValidArgumentLists() {
00126     return $this->allowedArgumentLists;
00127   }
00128 
00129 
00135   public function getMaximumArgumentList() {
00136     return end($this->allowedArgumentLists);
00137   }
00138 
00139 
00144   public function setInitialisationStatements() {
00145     if(count ($this->mandatoryArgumentNames) > 0) {
00146       foreach( $this->mandatoryArgumentNames as $name) {
00147         $this->initialisationStatements[] = "\$".$name." = ";
00148       }
00149     }
00150     if(count ($this->optionalArgumentNames) > 0) {
00151       foreach( $this->optionalArgumentNames as $name) {
00152         $this->initialisationStatements[] = "\$".$name." = ";
00153       }
00154     }
00155   }
00156   
00162   public function getInitialisationStatements() {
00163     return $this->initialisationStatements;
00164   }
00165 }
00166 ?>