<commit_before><?php

namespace Tlr\Assets\Assets;

use Illuminate\Http\Request;
use Illuminate\Routing\Controller;
use Tlr\Assets\Assets\AssetRenderer;

class AssetRenderController extends Controller
{

    /**
     * The asset renderer
     *
     * @var \Tlr\Assets\Assets\AssetRenderer
     */
    protected $renderer;

    public function __construct(AssetRenderer $renderer)
    {
        $this->renderer = $renderer;
    }

    /**
     * Render the given JS assets
     *
     * @Get("assets/scripts.js", as="assets.js")
     *
     * @return \Symfony\Component\HttpFoundation\Response
     */
    public function scripts(Request $request)
    {
        return response(
            $this->renderer->scripts( (array)$request->input('sources', []) ),
            200,
            ['Content-Type' => 'application/javascript; charset=UTF-8']
        );
    }


    /**
     * Render the given JS assets
     *
     * @Get("assets/styles.css", as="assets.css")
     *
     * @return \Symfony\Component\HttpFoundation\Response
     */
    public function styles(Request $request)
    {
        return response(
            $this->renderer->styles( (array)$request->input('sources', []) ),
            200,
            ['Content-Type' => 'text/css; charset=UTF-8']
        );
    }
}<commit_msg>resolve the assets before rendering from route<commit_after><?php

namespace Tlr\Assets\Assets;

use Illuminate\Http\Request;
use Illuminate\Routing\Controller;
use Tlr\Assets\Assets\AssetRenderer;
use Tlr\Assets\Assets\AssetResolver;

class AssetRenderController extends Controller
{
    /**
     * The asset renderer
     *
     * @var \Tlr\Assets\Assets\AssetRenderer
     */
    protected $renderer;

    /**
     * The asset resolver
     *
     * @var \Tlr\Assets\Assets\AssetResolver
     */
    protected $assets;

    public function __construct(AssetResolver $assets, AssetRenderer $renderer)
    {
        $this->renderer = $renderer;
        $this->assets = $assets;
    }

    /**
     * Render the given JS assets
     *
     * @Get("assets/scripts.js", as="assets.js")
     *
     * @return \Symfony\Component\HttpFoundation\Response
     */
    public function scripts(Request $request)
    {
        $assets = $this->assets->resolveArray((array)$request->input('sources', []));

        return response(
            $this->renderer->scripts( $assets ),
            200,
            ['Content-Type' => 'application/javascript; charset=UTF-8']
        );
    }


    /**
     * Render the given JS assets
     *
     * @Get("assets/styles.css", as="assets.css")
     *
     * @return \Symfony\Component\HttpFoundation\Response
     */
    public function styles(Request $request)
    {
        $assets = $this->assets->resolveArray((array)$request->input('sources', []));

        return response(
            $this->renderer->styles( $assets ),
            200,
            ['Content-Type' => 'text/css; charset=UTF-8']
        );
    }
}
{'fraction_non_alphanumeric': 0.1413080311758726, 'fraction_numerical': 0.005421890884445951, 'mean_word_length': 2.272727272727273, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 26, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '923026', 'n_tokens_mistral': 876, 'n_tokens_neox': 875, 'n_words': 159}