<commit_before><?php

namespace EM\GameBundle\Controller;

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

/**
 * @since 5.0
 */
abstract class AbstractAPIController extends Controller
{
    protected function prepareSerializedResponse($data, int $status = Response::HTTP_OK, array $headers = []) : Response
    {
        $header = $this->get('request_stack')->getMasterRequest()->headers->get('accept');
        $format = false !== strpos($header, 'application/xml') ? 'xml' : 'json';
        $headers['Content-Type'] = "application/{$format}";

        return new Response($this->get('jms_serializer')->serialize($data, $format), $status, $headers);
    }
}
<commit_msg>PHPDoc<commit_after><?php

namespace EM\GameBundle\Controller;

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

/**
 * @since 5.0
 */
abstract class AbstractAPIController extends Controller
{
    /**
     * @param mixed    $data
     * @param int      $status
     * @param string[] $headers
     *
     * @return Response
     */
    protected function prepareSerializedResponse($data, int $status = Response::HTTP_OK, array $headers = []) : Response
    {
        $header = $this->get('request_stack')->getMasterRequest()->headers->get('accept');
        $format = false !== strpos($header, 'application/xml') ? 'xml' : 'json';
        $headers['Content-Type'] = "application/{$format}";

        return new Response($this->get('jms_serializer')->serialize($data, $format), $status, $headers);
    }
}

{'fraction_non_alphanumeric': 0.1614321608040201, 'fraction_numerical': 0.002512562814070352, 'mean_word_length': 4.025236593059937, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 4}, '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': '6075151', 'n_tokens_mistral': 451, 'n_tokens_neox': 452, 'n_words': 89}