<commit_before><?php

namespace Alex\WebBundle\Controller;

use Symfony\Bundle\FrameworkBundle\Controller\Controller as BaseController;
use Symfony\Component\HttpFoundation\Response;

/**
 * A reusable controller.
 *
 * @author <NAME> <<EMAIL>>
 */
abstract class Controller extends BaseController
{
    /**
     * @return Doctrine\ORM\EntityRepository
     */
    public function getRepository($name)
    {
        return $this->getDoctrine()->getRepository($name);
    }

    /**
     * Adds a success message to the session flashbag.
     *
     * @param string $message
     *
     * @return Controller
     */
    public function addSuccess($message)
    {
        $this->get('session')->getFlashBag()->add('message_success', $message);

        return $this;
    }

    /**
     * Adds a warning message to the session flashbag.
     *
     * @param string $message
     *
     * @return Controller
     */
    public function addWarning($message)
    {
        $this->get('session')->getFlashBag()->add('message_warning', $message);
    }

    /**
     * Adds a error message to the session flashbag.
     *
     * @param string $message
     *
     * @return Controller
     */
    public function addError($message)
    {
        $this->get('session')->getFlashBag()->add('message_error', $message);
    }

    /**
     * Adds a notice message to the session flashbag.
     *
     * @param string $message
     *
     * @return Controller
     */
    public function addNotice($message)
    {
        $this->get('session')->getFlashBag()->add('message_notice', $message);
    }

    public function renderJson($data)
    {
        $response = new Response();
        $response->headers->set('Content-Type', 'application/json');
        $response->setContent(json_encode($data));

        return $response;
    }
}<commit_msg>change controller methods to protected<commit_after><?php

namespace Alex\WebBundle\Controller;

use Symfony\Bundle\FrameworkBundle\Controller\Controller as BaseController;
use Symfony\Component\HttpFoundation\Response;

/**
 * A reusable controller.
 *
 * @author <NAME> <<EMAIL>>
 */
abstract class Controller extends BaseController
{
    /**
     * @return Doctrine\ORM\EntityRepository
     */
    protected function getRepository($name)
    {
        return $this->getDoctrine()->getRepository($name);
    }

    /**
     * Adds a success message to the session flashbag.
     *
     * @param string $message
     *
     * @return Controller
     */
    protected function addSuccess($message)
    {
        $this->get('session')->getFlashBag()->add('message_success', $message);

        return $this;
    }

    /**
     * Adds a warning message to the session flashbag.
     *
     * @param string $message
     *
     * @return Controller
     */
    protected function addWarning($message)
    {
        $this->get('session')->getFlashBag()->add('message_warning', $message);
    }

    /**
     * Adds a error message to the session flashbag.
     *
     * @param string $message
     *
     * @return Controller
     */
    protected function addError($message)
    {
        $this->get('session')->getFlashBag()->add('message_error', $message);
    }

    /**
     * Adds a notice message to the session flashbag.
     *
     * @param string $message
     *
     * @return Controller
     */
    protected function addNotice($message)
    {
        $this->get('session')->getFlashBag()->add('message_notice', $message);
    }

    protected function renderJson($data)
    {
        $response = new Response();
        $response->headers->set('Content-Type', 'application/json');
        $response->setContent(json_encode($data));

        return $response;
    }
}
{'fraction_non_alphanumeric': 0.1368903260576664, 'fraction_numerical': 0.0, 'mean_word_length': 2.518483412322275, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 43, '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': '3593188', 'n_tokens_mistral': 1047, 'n_tokens_neox': 1021, 'n_words': 228}