From 899175380d07f311910961df874d6484c457acbe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Th=C3=A9odore=20Biadala?= Date: Tue, 29 Nov 2011 23:16:17 +0100 Subject: [PATCH] Handle arbitrary number of arguments properly, remove hack alert. --- lib/geometry/Geometry.class.php | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/lib/geometry/Geometry.class.php b/lib/geometry/Geometry.class.php index 6d48756d..a5091414 100644 --- a/lib/geometry/Geometry.class.php +++ b/lib/geometry/Geometry.class.php @@ -104,15 +104,8 @@ public function out() { $processor_type = $type_map[$format]; $processor = new $processor_type(); - // @@TODO: Hack alert! - // There has got to be a better way to do this... - // Is there an equivilent to call_user_func for objects??? - if (count($args) == 0) $result = $processor->write($this); - if (count($args) == 1) $result = $processor->write($this, $args[0]); - if (count($args) == 2) $result = $processor->write($this, $args[0],$args[1]); - if (count($args) == 3) $result = $processor->write($this, $args[0],$args[1],$args[2]); - if (count($args) == 4) $result = $processor->write($this, $args[0],$args[1],$args[2], $args[3]); - if (count($args) == 5) $result = $processor->write($this, $args[0],$args[1],$args[2], $args[3], $args[4]); + array_unshift($args, $this); + $result = call_user_func_array(array($processor, 'write'), $args); return $result; }