From e24eed7e4e410fabf7479a67d3a27e2596444505 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Fri, 2 Nov 2012 23:33:45 +0200 Subject: Some micro-optimizations --- tests/mocks/autoloader.php | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'tests/mocks/autoloader.php') diff --git a/tests/mocks/autoloader.php b/tests/mocks/autoloader.php index 5b202f159..4fc9c63b6 100644 --- a/tests/mocks/autoloader.php +++ b/tests/mocks/autoloader.php @@ -38,13 +38,11 @@ function autoload($class) if (strpos($class, 'Mock_') === 0) { - $class = str_replace(array('Mock_', '_'), array('', DIRECTORY_SEPARATOR), $class); - $class = strtolower($class); + $class = strtolower(str_replace(array('Mock_', '_'), array('', DIRECTORY_SEPARATOR), $class)); } elseif (strpos($class, 'CI_') === 0) { - $fragments = explode('_', $class, 2); - $subclass = next($fragments); + $subclass = substr($class, 3); if (in_array($subclass, $ci_core)) { @@ -88,7 +86,7 @@ function autoload($class) } } - $file = (isset($file)) ? $file : $dir.$class.'.php'; + $file = isset($file) ? $file : $dir.$class.'.php'; if ( ! file_exists($file)) { -- cgit v1.2.3-24-g4f1b From 1f884d6fece302ba53f106516880da4dd91f5660 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Fri, 9 Nov 2012 19:57:14 +0200 Subject: Move Log class to core in tests as well --- tests/mocks/autoloader.php | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'tests/mocks/autoloader.php') diff --git a/tests/mocks/autoloader.php b/tests/mocks/autoloader.php index 4fc9c63b6..3d216da1f 100644 --- a/tests/mocks/autoloader.php +++ b/tests/mocks/autoloader.php @@ -16,7 +16,7 @@ function autoload($class) $ci_core = array( 'Benchmark', 'Config', 'Controller', 'Exceptions', 'Hooks', 'Input', - 'Lang', 'Loader', 'Model', + 'Lang', 'Loader', 'Log', 'Model', 'Output', 'Router', 'Security', 'URI', 'Utf8', ); @@ -25,11 +25,10 @@ function autoload($class) 'Calendar', 'Cart', 'Driver_Library', 'Email', 'Encrypt', 'Form_validation', 'Ftp', 'Image_lib', 'Javascript', - 'Log', 'Migration', 'Pagination', - 'Parser', 'Profiler', 'Table', - 'Trackback', 'Typography', 'Unit_test', - 'Upload', 'User_agent', 'Xmlrpc', - 'Zip', + 'Migration', 'Pagination', 'Parser', + 'Profiler', 'Table', 'Trackback', + 'Typography', 'Unit_test', 'Upload', + 'User_agent', 'Xmlrpc', 'Zip' ); $ci_drivers = array( -- cgit v1.2.3-24-g4f1b