<commit_before><?php

namespace Bolt\Response;

use Symfony\Component\HttpFoundation\Response;

/**
 * BoltResponse represents a prepared Bolt HTTP response.
 *
 * A StreamedResponse uses a renderer and context variables 
 * to create the response content.
 *
 *
 * @author <NAME> <<EMAIL>>
 *
 */
class BoltResponse extends Response
{
    protected $renderer;
    protected $context = array();

    /**
     * Constructor.
     *
     * @param Renderer      $renderer An object that is able to render a template with context
     * @param array         $context  An array of context variables
     * @param int           $status   The response status code
     * @param array         $headers  An array of response headers
     *
     */
    public function __construct($renderer, $context = array(), $status = 200, $headers = array())
    {
        parent::__construct(null, $status, $headers);
        $this->renderer = $renderer;
        $this->context = $context;
        $output = $this->getRenderer()->render($this->getContext());
        $this->setContent($output);
    }

    /**
     * Factory method for chainability
     *
     * @param Renderer      $renderer An object that is able to render a template with context
     * @param array         $context  An array of context variables
     * @param int           $status   The response status code
     * @param array         $headers  An array of response headers
     *
     * @return BoltResponse
     */
    public static function create($renderer, $context = array(), $status = 200, $headers = array())
    {
        return new static($renderer, $context, $status, $headers);
    }

    /**
     * Sets the Renderer used to create this Response.
     *
     * @param Renderer $renderer A renderer object
     *
     */
    public function setRenderer($renderer)<commit_msg>add type default<commit_after><?php

namespace Bolt\Response;

use Symfony\Component\HttpFoundation\Response;

/**
 * BoltResponse represents a prepared Bolt HTTP response.
 *
 * A StreamedResponse uses a renderer and context variables 
 * to create the response content.
 *
 *
 * @author <NAME> <<EMAIL>>
 *
 */
class BoltResponse extends Response
{
    protected $renderer;
    protected $context = array();

    /**
     * Constructor.
     *
     * @param Renderer      $renderer An object that is able to render a template with context
     * @param array         $context  An array of context variables
     * @param int           $status   The response status code
     * @param array         $headers  An array of response headers
     *
     */
    public function __construct($renderer, $context = array(), $status = 200, $headers = array())
    {
        parent::__construct(null, $status, $headers);
        $this->renderer = $renderer;
        $this->context = $context;
        $output = $this->getRenderer()->render($this->getContext());
        $this->setContent($output);
    }

    /**
     * Factory method for chainability
     *
     * @param Renderer      $renderer An object that is able to render a template with context
     * @param array         $context  An array of context variables
     * @param int           $status   The response status code
     * @param array         $headers  An array of response headers
     *
     * @return BoltResponse
     */
    public static function create($renderer = null, $context = array(), $status = 200, $headers = array())
    {
        return new static($renderer, $context, $status, $headers);
    }

    /**
     * Sets the Renderer used to create this Response.
     *
     * @param Renderer $renderer A renderer object
     *
     */
    public function setRenderer($renderer)
{'fraction_non_alphanumeric': 0.10319609967497291, 'fraction_numerical': 0.0032502708559046588, 'mean_word_length': 2.4481792717086837, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 21, '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': '7222993', 'n_tokens_mistral': 971, 'n_tokens_neox': 973, 'n_words': 342}