public static function requireDependency($layer, $dependency, $relativeTo = null) { list($subdir, $class) = self::dependencySubDir($dependency, $relativeTo); $path = APP_DIR . "/{$layer}/{$subdir}" . SInflection::underscore($class) . '.php'; if (!file_exists($path)) { throw new SException("Missing " . SInflection::singularize($layer) . " {$dependency}"); } require_once $path; }
/** * Converts the class name from something like "WeblogController" to "weblog" */ public function controllerName() { return SInflection::underscore(str_replace('Controller', '', $this->controllerClassName())); }
function testUnderscore() { $this->assertEqual('my_test_controller', SInflection::underscore('MyTestController')); $this->assertEqual('s_my_test_controller', SInflection::underscore('SMyTestController')); }