summaryrefslogtreecommitdiff
path: root/scripts/dev/generate-phpt/src/gtFunction.php
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/dev/generate-phpt/src/gtFunction.php')
-rw-r--r--scripts/dev/generate-phpt/src/gtFunction.php48
1 files changed, 48 insertions, 0 deletions
diff --git a/scripts/dev/generate-phpt/src/gtFunction.php b/scripts/dev/generate-phpt/src/gtFunction.php
new file mode 100644
index 0000000..7405821
--- /dev/null
+++ b/scripts/dev/generate-phpt/src/gtFunction.php
@@ -0,0 +1,48 @@
+<?php
+
+/**
+ * Class reperesents a single PHP function.
+ *
+ */
+class gtFunction extends gtTestSubject {
+
+ private $functionName;
+
+ /**
+ * Set the name of the name of the function
+ *
+ * @param string $functionName
+ */
+ public function __construct($functionName) {
+ $this->functionName = $functionName;
+ }
+
+
+ /**
+ * Get the names of function argments and initialise mandatory and optional argument arrays
+ *
+ */
+ public function setArgumentNames() {
+ $function= new ReflectionFunction($this->functionName);
+
+ foreach ($function->getParameters() as $i => $param) {
+ if($param->isOptional()) {
+ $this->optionalArgumentNames[] = $param->getName();
+ } else {
+ $this->mandatoryArgumentNames[] = $param->getName();
+ }
+ }
+ }
+
+
+ /**
+ * Return the name of the function
+ *
+ * @return string
+ */
+ public function getName() {
+ return $this->functionName;
+ }
+
+}
+?> \ No newline at end of file