<commit_before><?php

declare(strict_types=1);

namespace AppBundle\Controller\Home;

use AppBundle\Entity\WiredQuestion;
use AppBundle\Exceptions\QuestionException;
use AppBundle\Repository\CompletedQuizRepository;
use AppBundle\Repository\QuestionRepository;
use AppBundle\Repository\WiredQuestionRepository;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\Request;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Symfony\Component\HttpFoundation\Response;

class HomeController extends Controller
{
    /**
     * @Route("/", name="homepage")
     */
    public function showHomePageAction(Request $request)
    {
        $em = $this->get('doctrine.orm.entity_manager');
        $dql = "SELECT q FROM AppBundle\Entity\Quiz q";
        $query = $em->createQuery($dql);

        $paginator = $this->get('knp_paginator');

        $pagination = $paginator->paginate(
            $query,
            $request->query->getInt('page', 1),
            9
        );

        return $this->render('home/homepage.html.twig', array('pagination' => $pagination));
    }

    /**
     * @Route("/started-quizes", name="started_quizes")
     */
    public function showStartedQuizesAction(Request $request)
    {
        /** @var WiredQuestionRepository $em */
        $em = $this->getDoctrine()->getManager()->getRepository("AppBundle\Entity\WiredQuestion");
        try {
            $em->abraKadaBra();
        }catch (QuestionException $exception){
            return new Response($exception->getMessage());
        }
       return $this->render("base.html.twig");
    }

    /**
     * @Route("/test")
     */
    public function test(Request $request)
    {
        $em = $this->getDoctrine();
        return $this->render("base.html.twig");
    }
}<commit_msg>fix bug<commit_after><?php

declare(strict_types=1);

namespace AppBundle\Controller\Home;

use AppBundle\Entity\WiredQuestion;
use AppBundle\Exceptions\QuestionException;
use AppBundle\Repository\CompletedQuizRepository;
use AppBundle\Repository\QuestionRepository;
use AppBundle\Repository\WiredQuestionRepository;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\Request;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Symfony\Component\HttpFoundation\Response;

class HomeController extends Controller
{
    /**
     * @Route("/", name="homepage")
     */
    public function showHomePageAction(Request $request)
    {
        $em = $this->get('doctrine.orm.entity_manager');
        $dql = "SELECT q FROM AppBundle\Entity\Quiz q";
        $query = $em->createQuery($dql);

        $paginator = $this->get('knp_paginator');

        $pagination = $paginator->paginate(
            $query,
            $request->query->getInt('page', 1),
            9
        );

        return $this->render('home/homepage.html.twig', array('pagination' => $pagination));
    }

    /**
     * @Route("/started-quizes", name="started_quizes")
     */
    public function showStartedQuizesAction(Request $request)
    {
        $quizRepository = $this->getDoctrine()->getManager()->getRepository("AppBundle\Entity\Quiz");
        $quiz = $quizRepository->findOneBy(array("id"=>10));
        /** @var CompletedQuizRepository $completedQuizRep */
        $completedQuizRep = $this->getDoctrine()->getManager()->getRepository("AppBundle\Entity\CompletedQuiz");
        $compleQuiz = $completedQuizRep->findOneBy(array("user"=>$this->getUser(), "quiz"=>$quiz));
        /** @var \DateInterval $time */
        $time = $compleQuiz->getTime();
        //$pos = $completedQuizRep->loadUserPosition($compleQuiz->getRightQuestions(),$compleQuiz->getTime()->);
        exit(dump($time));
        return $this->render("base.html.twig");
    }   
}
{'fraction_non_alphanumeric': 0.14797747055811572, 'fraction_numerical': 0.002048131080389145, 'mean_word_length': 3.454960091220068, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 45, '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': '3394021', 'n_tokens_mistral': 1153, 'n_tokens_neox': 1128, 'n_words': 171}