Commit d1d4ac10 authored by Taylor Otwell's avatar Taylor Otwell

Refactor the view class method order and comments.

parent 6590b54f
......@@ -136,7 +136,7 @@ class View {
{
$composer = static::$composers[$this->module][$this->view];
if ( ! is_null($composer = $this->find_composer_handler($composer)))
if ( ! is_null($composer = $this->find_composer_function($composer)))
{
call_user_func($composer, $this);
}
......@@ -144,15 +144,31 @@ class View {
}
/**
* Find the composer handler / function in a composer definition.
* Load the view composers for a given module.
*
* @param string $module
* @return void
*/
private static function load_composers($module)
{
if (isset(static::$composers[$module])) return;
$composers = ($module == 'application') ? APP_PATH.'composers'.EXT : MODULE_PATH.$module.'/composers'.EXT;
static::$composers[$module] = (file_exists($composers)) ? require $composers : array();
}
/**
* Find the composer function in a composer definition.
*
* If the composer value itself is callable, it will be returned, otherwise the
* first callable value in the composer array will be returned.
* first callable value in the composer array will be returned. If the composer
* value is a string, it is simply a view name being defined.
*
* @param mixed $composer
* @return Closure
*/
private function find_composer_handler($composer)
private function find_composer_function($composer)
{
if (is_string($composer)) return;
......@@ -164,21 +180,6 @@ class View {
}
}
/**
* Load the view composers for a given module.
*
* @param string $module
* @return void
*/
private static function load_composers($module)
{
if (isset(static::$composers[$module])) return;
$composers = ($module == 'application') ? APP_PATH.'composers'.EXT : MODULE_PATH.$module.'/composers'.EXT;
static::$composers[$module] = (file_exists($composers)) ? require $composers : array();
}
/**
* Get the parsed content of the view.
*
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment