public static function initialize($with_cache = true) { $tmp_dir = sfToolkit::getTmpDir(); if (is_readable($tmp_dir . DIRECTORY_SEPARATOR . 'sf_autoload_paths.php')) { self::$class_paths = unserialize(file_get_contents($tmp_dir . DIRECTORY_SEPARATOR . 'sf_autoload_paths.php')); } else { $files = pakeFinder::type('file')->name('*.class.php')->ignore_version_control()->in(realpath(dirname(__FILE__) . '/../../lib')); self::$class_paths = array(); foreach ($files as $file) { preg_match_all('~^\\s*(?:abstract\\s+|final\\s+)?(?:class|interface)\\s+(\\w+)~mi', file_get_contents($file), $classes); foreach ($classes[1] as $class) { self::$class_paths[$class] = $file; } } if ($with_cache) { file_put_contents($tmp_dir . DIRECTORY_SEPARATOR . 'sf_autoload_paths.php', serialize(self::$class_paths)); } } }