<commit_before><?php

namespace Pierstoval\Bundle\CharacterManagerBundle\Controller;

use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\RedirectResponse;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;

class StepController extends Controller
{
    /**
     * @Route("/generate", name="pierstoval_character_generator_index")
     *
     * @return RedirectResponse
     */
    public function indexAction()
    {
        $steps = $this->getParameter('pierstoval_character_manager.steps');

        reset($steps);
        $firstStep = current($steps);

        return $this->redirect($this->generateUrl('pierstoval_character_generator_step', [
            'step' => $firstStep['name'],
        ]));
    }

    /**
     * @Route("/reset/", name="pierstoval_character_generator_reset")
     */
    public function resetAction()
    {
        $session = $this->get('session');
        $session->set('character', []);
        $session->set('step', 1);
        $session->getFlashBag()->add('success', 'Le personnage en cours de création a été réinitialisé !');

        return $this->redirect($this->generateUrl('pierstoval_character_generator_index'));
    }

    /**
     * @Route("/generate/{step}", requirements={"step" = "\w+"}, name="pierstoval_character_generator_step")
     *
     * @param Request $request
     *
     * @return array|RedirectResponse|Response
     */
    public function stepAction($step, Request $request)<commit_msg>Fix some generator tests #1703 @0.33<commit_after><?php

namespace Pierstoval\Bundle\CharacterManagerBundle\Controller;

use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\RedirectResponse;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;

class StepController extends Controller
{
    /**
     * @Route("/generate", name="pierstoval_character_generator_index")
     *
     * @return RedirectResponse
     */
    public function indexAction()
    {
        $steps = $this->getParameter('pierstoval_character_manager.steps');

        reset($steps);
        $firstStep = current($steps);

        return $this->redirectToRoute('pierstoval_character_generator_step', [
            'step' => $firstStep['name'],
        ]);
    }

    /**
     * @Route("/reset/", name="pierstoval_character_generator_reset")
     */
    public function resetAction()
    {
        $session = $this->get('session');
        $session->set('character', []);
        $session->set('step', 1);
        $session->getFlashBag()->add('success', 'Le personnage en cours de création a été réinitialisé !');

        return $this->redirect($this->generateUrl('pierstoval_character_generator_index'));
    }

    /**
     * @Route("/generate/{step}", requirements={"step" = "[\w-]+"}, name="pierstoval_character_generator_step")
     *
     * @param Request $request
     *
     * @return array|RedirectResponse|Response
     */
    public function stepAction($step, Request $request)
{'fraction_non_alphanumeric': 0.14205079962370648, 'fraction_numerical': 0.0028222013170272815, 'mean_word_length': 3.643377001455604, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 24, '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': '216590', 'n_tokens_mistral': 898, 'n_tokens_neox': 890, 'n_words': 142}