<?php
abstract class gtTestSubject {
protected $optionalArgumentNames;
protected $mandatoryArgumentNames;
protected $extraArgumentList = '';
protected $shortArgumentList = '';
protected $allowedArgumentLists;
protected $maximumArgumentList;
protected $initialisationStatements;
public function getMandatoryArgumentNames() {
return $this->mandatoryArgumentNames;
}
public function getOptionalArgumentNames() {
return $this->optionalArgumentNames;
}
public function setArgumentLists() {
$this->setValidArgumentLists();
$this->setExtraArgumentList();
$this->setShortArgumentList();
}
public function setExtraArgumentList() {
if(count ($this->mandatoryArgumentNames) > 0) {
for( $i = 0; $i < count( $this->mandatoryArgumentNames ); $i++) {
$this->extraArgumentList .= "\$".$this->mandatoryArgumentNames[$i].", ";
}
}
if(count ($this->optionalArgumentNames) > 0) {
for( $i = 0; $i < count( $this->optionalArgumentNames ); $i++) {
$this->extraArgumentList .= "\$".$this->optionalArgumentNames[$i].", ";
}
}
$this->extraArgumentList= $this->extraArgumentList. "\$extra_arg";
}
public function getExtraArgumentList() {
return $this->extraArgumentList;
}
public function setShortArgumentList() {
if(count ($this->mandatoryArgumentNames) > 0) {
for( $i = 0; $i < count( $this->mandatoryArgumentNames ) - 1; $i++) {
$this->shortArgumentList .= "\$".$this->mandatoryArgumentNames[$i].", ";
}
$this->shortArgumentList = substr($this->shortArgumentList, 0, -2);
}
}
public function getShortArgumentList() {
return $this->shortArgumentList;
}
public function setValidArgumentLists() {
$this->allowedArgumentLists[0] = '';
if(count ($this->mandatoryArgumentNames) > 0) {
for( $i = 0; $i < count( $this->mandatoryArgumentNames ); $i++) {
$this->allowedArgumentLists[0] .= "\$".$this->mandatoryArgumentNames[$i].", ";
}
}
if(count ($this->optionalArgumentNames) > 0) {
for( $i = 0; $i < count( $this->optionalArgumentNames ); $i++) {
$this->allowedArgumentLists[] = $this->allowedArgumentLists[$i]."\$".$this->optionalArgumentNames[$i].", ";
$this->allowedArgumentLists[$i] = substr ($this->allowedArgumentLists[$i], 0, -2);
}
}
$this->allowedArgumentLists[count($this->allowedArgumentLists) -1 ] = substr($this->allowedArgumentLists[count($this->allowedArgumentLists) -1 ], 0, -2);
}
public function getValidArgumentLists() {
return $this->allowedArgumentLists;
}
public function getMaximumArgumentList() {
return end($this->allowedArgumentLists);
}
public function setInitialisationStatements() {
if(count ($this->mandatoryArgumentNames) > 0) {
foreach( $this->mandatoryArgumentNames as $name) {
$this->initialisationStatements[] = "\$".$name." = ";
}
}
if(count ($this->optionalArgumentNames) > 0) {
foreach( $this->optionalArgumentNames as $name) {
$this->initialisationStatements[] = "\$".$name." = ";
}
}
}
public function getInitialisationStatements() {
return $this->initialisationStatements;
}
}
?>