<?php

if ( ! function_exists('basset_stylesheet'))
{
    /**
     * Ouput the stylesheets for a given collection.
     * 
     * @param  string  $collection
     * @return string
     */
    function basset_stylesheet($name)
    {
        return app('basset.output')->stylesheets($name);
    }
}

if ( ! function_exists('basset_javascript'))
{
    /**
     * Ouput the javascripts for a given collection.
     * 
     * @param  string  $collection
     * @return string
     */
    function basset_javascript($collection)
    {
        return app('basset.output')->javascripts($collection);
    }
}

if ( ! function_exists('array_to_newlines'))
{
    /**
     * Convert an array to a newline separated string.
     * 
     * @param  array  $array
     * @return string
     */
    function array_to_newlines(array $array)
    {
        return implode(PHP_EOL, $array);
    }
}
<?php

if ( ! function_exists('basset_stylesheet'))
{
    /**
     * Ouput the stylesheets for several collections.
     * 
     * @return string
     */
    function basset_stylesheet()
    {
        return basset_collections(func_get_args(), 'stylesheets');
    }
}

if ( ! function_exists('basset_javascript'))
{
    /**
     * Ouput the javascripts for several collections.
     * 
     * @return string
     */
    function basset_javascript()
    {
        return basset_collections(func_get_args(), 'javascripts');
    }
}

if ( ! function_exists('basset_collections'))
{
    /**
     * Output a given group for an array of collections.
     * 
     * @param  array  $collections
     * @param  string  $group
     * @return string
     */
    function basset_collections(array $collections, $group)
    {
        $responses = array();

        foreach ($collections as $collection)
        {
            $responses[] = app('basset.output')->$group($name);
        }

        return array_to_newlines($responses);
    }
}

if ( ! function_exists('array_to_newlines'))
{
    /**
     * Convert an array to a newline separated string.
     * 
     * @param  array  $array
     * @return string
     */
    function array_to_newlines(array $array)
    {
        return implode(PHP_EOL, $array);
    }
}
Allow multiple collections to be outputted in views.
Allow multiple collections to be outputted in views.

Signed-off-by: Jason Lewis <b136be6b8ecc2c62ceb9857ec62bf85489a45e0c@gmail.com>
