<commit_before><?php

declare(strict_types=1);

namespace App\Controllers;

use App\Generators\CatGenerator;
use App\Generators\DogeGenerator;
use App\Generators\MultiGenerator;
use App\Generators\ValidatingGenerator;
use Illuminate\Contracts\Container\Container;
use Illuminate\Contracts\View\Factory;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
use Illuminate\Http\Response;
use Laravel\Lumen\Routing\Controller;

/**
 * This is the main controller class.
 *
 * @author <NAME> <<EMAIL>>
 */
class MainController extends Controller
{
    /**
     * Show the homepage.
     *
     * @param \Illuminate\Contracts\View\Factory $view
     *
     * @return \Illuminate\Http\Response
     */
    public function show(Factory $view)
    {
        return new Response($view->make('index'));
    }

    /**
     * Generate the memes.
     *
     * @param \Illuminate\Contracts\Container\Container $container
     * @param \Illuminate\Http\Request                  $request
     *
     * @return \Illuminate\Http\Response
     */
    public function generate(Container $container, Request $request)
    {
        $inner = $container->make(random_int(0, 1) ? CatGenerator::class : DogeGenerator::class);

        $generator = new ValidatingGenerator(new MultiGenerator($inner));

        $images = $generator->start((string) $request->get('text'))->wait();

        return new JsonResponse([
            'success' => ['message' => 'Here are your memes!'],
            'data'    => ['images' => $images],<commit_msg>Generate 2 doge images rather than 3<commit_after><?php

declare(strict_types=1);

namespace App\Controllers;

use App\Generators\CatGenerator;
use App\Generators\DogeGenerator;
use App\Generators\MultiGenerator;
use App\Generators\ValidatingGenerator;
use Illuminate\Contracts\Container\Container;
use Illuminate\Contracts\View\Factory;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
use Illuminate\Http\Response;
use Laravel\Lumen\Routing\Controller;

/**
 * This is the main controller class.
 *
 * @author <NAME> <<EMAIL>>
 */
class MainController extends Controller
{
    /**
     * Show the homepage.
     *
     * @param \Illuminate\Contracts\View\Factory $view
     *
     * @return \Illuminate\Http\Response
     */
    public function show(Factory $view)
    {
        return new Response($view->make('index'));
    }

    /**
     * Generate the memes.
     *
     * @param \Illuminate\Contracts\Container\Container $container
     * @param \Illuminate\Http\Request                  $request
     *
     * @return \Illuminate\Http\Response
     */
    public function generate(Container $container, Request $request)
    {
        $doge = (bool) random_int(0, 1);

        $inner = $container->make($doge ? CatGenerator::class : DogeGenerator::class);

        $generator = new ValidatingGenerator(new MultiGenerator($inner, $doge ? 2 : 3));

        $images = $generator->start((string) $request->get('text'))->wait();

        return new JsonResponse([
            'success' => ['message' => 'Here are your memes!'],
            'data'    => ['images' => $images],
{'fraction_non_alphanumeric': 0.1341033044594161, 'fraction_numerical': 0.003208213025344883, 'mean_word_length': 3.0865006553079946, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 27, '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': '7639615', 'n_tokens_mistral': 894, 'n_tokens_neox': 920, 'n_words': 197}