<commit_before><?php

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

namespace ByCedric\Allay\Http\Middleware;

use Illuminate\Contracts\Config\Repository;
use Illuminate\Http\Response;

class UpdateStatusCodeByRequestMethod
{
    /**
     * The status code mapping, by request method.
     *
     * @var array
     */
    protected $statuses;

    /**
     * Create a new response status updating middleware.
     *
     * @param  \Illuminate\Contracts\Config\Repository $config
     * @return void
     */
    public function __construct(Repository $config)
    {
        $this->statuses = $config->get('allay.statuses');
    }

    /**
     * Update the status code of the response, if it's set to default and.
     * @param  \Illuminate\Http\Request  $request
     * @param  \Closure                  $next
     * @return \Illuminate\Http\Response
     */
    public function handle($request, \Closure $next)
    {
        $response = $next($request);

        if ($response instanceof Response) {
            $this->updateStatus($request, $response);
        }

        return $response;
    }

    /**
     * Update the status code of the response, by request method.
     *
     * @param  \Illuminate\Http\Request  $request
     * @param  \Illuminate\Http\Response $response
     * @return void
     */<commit_msg>Added missing newline within the phpdoc.<commit_after><?php

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

namespace ByCedric\Allay\Http\Middleware;

use Illuminate\Contracts\Config\Repository;
use Illuminate\Http\Response;

class UpdateStatusCodeByRequestMethod
{
    /**
     * The status code mapping, by request method.
     *
     * @var array
     */
    protected $statuses;

    /**
     * Create a new response status updating middleware.
     *
     * @param  \Illuminate\Contracts\Config\Repository $config
     * @return void
     */
    public function __construct(Repository $config)
    {
        $this->statuses = $config->get('allay.statuses');
    }

    /**
     * Update the status code of the response, if it's set to default and.
     *
     * @param  \Illuminate\Http\Request  $request
     * @param  \Closure                  $next
     * @return \Illuminate\Http\Response
     */
    public function handle($request, \Closure $next)
    {
        $response = $next($request);

        if ($response instanceof Response) {
            $this->updateStatus($request, $response);
        }

        return $response;
    }

    /**
     * Update the status code of the response, by request method.
     *
     * @param  \Illuminate\Http\Request  $request
     * @param  \Illuminate\Http\Response $response
     * @return void
     */
{'fraction_non_alphanumeric': 0.11007338225483655, 'fraction_numerical': 0.0, 'mean_word_length': 2.3285238623751385, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 15, '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': '1559940', 'n_tokens_mistral': 848, 'n_tokens_neox': 862, 'n_words': 249}