function handler_file($handler) { if (str_contains('/', $handler)) { $pieces = explode('/', $handler); $handler_basename = array_pop($pieces); } else { $handler_basename = $handler; } return handler_dir($handler) . "{$handler_basename}.handler.php"; }
function handler_templates_dir($handler) { return handler_dir($handler) . 'templates' . DIRECTORY_SEPARATOR; }
function test_handler_file() { should_return(handler_dir('foo') . "foo.handler.php", when_passed('foo')); should_return(handler_dir('foo/bar') . "bar.handler.php", when_passed('foo/bar')); should_return(handler_dir('foo/bar/baz') . "baz.handler.php", when_passed('foo/bar/baz')); }