<commit_before><?php
/**
* This file is part of the PhpStorm.
* (c) johann (<EMAIL>)
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
**/

namespace Certificationy\Bundle\CertyBundle\Controller;

use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\Request;

class CertyController extends Controller
{
    /**
     * @param Request $request
     */
    public function guidelinesAction(Request $request, $name)
    {
        $certificationManager = $this->container->get('certificationy.certification.manager');
        $certification = $certificationManager->getCertification($name);

        //Clear previous session when we are at the point to start new one
        if ($request->getSession()->has('certification')) {
            $request->getSession()->remove('certification');
        }

        return $this->render('CertificationyCertyBundle:Certification:guidelines.html.twig', array(
            'certification' => $certification
        ));
    }

    /**
     * @param Request $request
     * @param         $name
     */
    public function testAction(Request $request, $name)
    {
        $certificationHandler = $this->container->get('certy.certification.form_handler');

        $certificationManager = $this->container->get('certificationy.certification.manager');
        $certification = $certificationManager->getCertification($name);

        //Handle form
        if ($certification = $certificationHandler->process($certification)) {

            //today is enough
            $request->getSession()->set('certification', $certification);

            //Let's see the result
            return $this->forward('CertificationyCertyBundle:Certy:report');
        }

        return $this->render('CertificationyCertyBundle:Certification:test.html.twig', array(
            'certification' => $certification,
            'form' => $certificationHandler->createView()
        ));
    }

    /**
     * @param Request $request
     */
    public function reportAction(Request $request)
    {
        $certification = $request->getSession()->get('certification');

        //Certification does'nt exist in session
        if (null === $certification) {
            $router = $this->container->get('router');

//            return new RedirectResponse();
        }

        return $this->render('@CertificationyCerty/Certification/report.html.twig', array(
            'certification' => $certification
        ));
    }
}<commit_msg>Remove session storage. We don't need.<commit_after><?php
/**
* This file is part of the PhpStorm.
* (c) johann (<EMAIL>)
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
**/

namespace Certificationy\Bundle\CertyBundle\Controller;

use Certificationy\Component\Certy\Model\Certification;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\Request;

class CertyController extends Controller
{
    /**
     * @param Request $request
     */
    public function guidelinesAction(Request $request, $name)
    {
        $certificationManager = $this->container->get('certificationy.certification.manager');
        $certification = $certificationManager->getCertification($name);

        return $this->render('CertificationyCertyBundle:Certification:guidelines.html.twig', array(
            'certification' => $certification
        ));
    }

    /**
     * @param Request $request
     * @param string  $name
     */
    public function testAction(Request $request, $name)
    {
        $certificationHandler = $this->container->get('certy.certification.form_handler');
        $certificationManager = $this->container->get('certificationy.certification.manager');

        $certification = $certificationManager->getCertification($name);

        if ($certification = $certificationHandler->process($certification)) {
            return $this->reportAction($request, $certification);
        }

        return $this->render('CertificationyCertyBundle:Certification:test.html.twig', array(
            'certification' => $certification,
            'form' => $certificationHandler->createView()
        ));
    }

    /**
     * @param Request $request
     */
    public function reportAction(Request $request, Certification $certification)
    {
        return $this->render('CertificationyCertyBundle:Certification:report.html.twig', array(
            'certification' => $certification
        ));
    }
}
{'fraction_non_alphanumeric': 0.12567949554250923, 'fraction_numerical': 0.0, 'mean_word_length': 3.1144901610017888, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 51, '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': '2370819', 'n_tokens_mistral': 1222, 'n_tokens_neox': 1191, 'n_words': 247}