From a8b0efb5012618dcfa54a88a417929f7d1f2be15 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Tue, 25 Mar 2014 13:47:42 +0200 Subject: Simplify callback routes There's no need for all that Reflection magic, it's only slowing down the whole process --- system/core/Router.php | 29 ----------------------------- 1 file changed, 29 deletions(-) (limited to 'system/core') diff --git a/system/core/Router.php b/system/core/Router.php index 2448d9c8c..765e32374 100644 --- a/system/core/Router.php +++ b/system/core/Router.php @@ -399,35 +399,6 @@ class CI_Router { // Remove the original string from the matches array. array_shift($matches); - // Get the match count. - $match_count = count($matches); - - // Determine how many parameters the callback has. - $reflection = new ReflectionFunction($val); - $param_count = $reflection->getNumberOfParameters(); - - // Are there more parameters than matches? - if ($param_count > $match_count) - { - // Any params without matches will be set to an empty string. - $matches = array_merge($matches, array_fill($match_count, $param_count - $match_count, '')); - - $match_count = $param_count; - } - - // Get the parameters so we can use their default values. - $params = $reflection->getParameters(); - - for ($m = 0; $m < $match_count; $m++) - { - // Is the match empty and does a default value exist? - if (empty($matches[$m]) && $params[$m]->isDefaultValueAvailable()) - { - // Substitute the empty match for the default value. - $matches[$m] = $params[$m]->getDefaultValue(); - } - } - // Execute the callback using the values in matches as its parameters. $val = call_user_func_array($val, $matches); } -- cgit v1.2.3-24-g4f1b