1<?php 2 3/** 4 * Class reperesents a single PHP function. 5 * 6 */ 7class gtFunction extends gtTestSubject { 8 9 private $functionName; 10 11 /** 12 * Set the name of the name of the function 13 * 14 * @param string $functionName 15 */ 16 public function __construct($functionName) { 17 $this->functionName = $functionName; 18 } 19 20 21 /** 22 * Get the names of function arguments and initialise mandatory and optional argument arrays 23 * 24 */ 25 public function setArgumentNames() { 26 $function= new ReflectionFunction($this->functionName); 27 28 foreach ($function->getParameters() as $i => $param) { 29 if($param->isOptional()) { 30 $this->optionalArgumentNames[] = $param->getName(); 31 } else { 32 $this->mandatoryArgumentNames[] = $param->getName(); 33 } 34 } 35 } 36 37 38 /** 39 * Return the name of the function 40 * 41 * @return string 42 */ 43 public function getName() { 44 return $this->functionName; 45 } 46 47} 48?> 49