public function when($template, callable $callback)
    {
        if (\is_array($template)) {
            foreach ($template as $current) {
                static::$composers[ $current ][] = $callback;
            }

            return;
        }

        static::$composers[ $template ][] = $callback;
    }
public function when($template, callable $callback)
    {
        if (\is_array($template)) {
            foreach ($template as $current) {
                static::$composers[ $current ][] = $callback;
            }

            return;
        }

        static::$composers[ $template ][] = $callback;
    }
public function when ( $ template , callable $ callback ) { if ( \ is_array ( $ template ) ) { foreach ( $ template as $ current ) { static :: $ composers [ $ current ] [ ] = $ callback ; } return ; } static :: $ composers [ $ template ] [ ] = $ callback ; }
Adds data to specific templates only.

The callback is run just before the template is rendered, so could feasibly be used for
purposes other than adding data.

The callback is passed the current view instance, and the current data for the template being rendered.

@since  1.0.0

@param  string|array $template The template(s) to add the callback to.
@param  callable     $callback The callback function run before the $template is rendered.
Adds data to specific templates only .