<commit_before><?php

namespace Basal;

use Basal\Middleware\MiddlewareDispatcherInterface;
use Basal\Response\ResponseEmitterInterface;
use Interop\Http\Factory\ServerRequestFactoryInterface;
use Interop\Http\ServerMiddleware\MiddlewareInterface;
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface;

/**
 * Class Basal.
 */
class Basal implements BasalInterface
{
    /** @var MiddlewareDispatcherInterface */
    private $dispatcher;

    /** @var ResponseEmitterInterface */
    private $emitter;

    /** @var ServerRequestFactoryInterface */
    private $requestFactory;

    /** @var MiddlewareInterface[] */
    private $stack = [];

    /**
     * Basal constructor.
     *
     * @param MiddlewareDispatcherInterface $dispatcher
     * @param ResponseEmitterInterface $emitter
     * @param ServerRequestFactoryInterface $requestFactory
     */
    public function __construct(
        MiddlewareDispatcherInterface $dispatcher,
        ResponseEmitterInterface $emitter,
        ServerRequestFactoryInterface $requestFactory
    ) {
        $this->dispatcher = $dispatcher;
        $this->emitter = $emitter;
        $this->requestFactory = $requestFactory;
    }

    /**
     * Run application with server request globals.
     */
    public function run()
    {
        $request = $this->requestFactory->createServerRequest($_SERVER);
        $this->send($this->handleRequest($request));
    }

    /**
     * @inheritdoc
     */
    public function addMiddleware(MiddlewareInterface $middleware)
    {
        $this->stack[] = $middleware;
    }

    /**
     * @inheritdoc
     */
    public function handleRequest(ServerRequestInterface $request)
    {
        return $this->dispatcher->dispatch($request, $this->stack);
    }

    /**
     * @inheritdoc
     */
    public function send(ResponseInterface $response)<commit_msg>Added query parameters to from globals run()<commit_after><?php

namespace Basal;

use Basal\Middleware\MiddlewareDispatcherInterface;
use Basal\Response\ResponseEmitterInterface;
use Interop\Http\Factory\ServerRequestFactoryInterface;
use Interop\Http\ServerMiddleware\MiddlewareInterface;
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface;

/**
 * Class Basal.
 */
class Basal implements BasalInterface
{
    /** @var MiddlewareDispatcherInterface */
    private $dispatcher;

    /** @var ResponseEmitterInterface */
    private $emitter;

    /** @var ServerRequestFactoryInterface */
    private $requestFactory;

    /** @var MiddlewareInterface[] */
    private $stack = [];

    /**
     * Basal constructor.
     *
     * @param MiddlewareDispatcherInterface $dispatcher
     * @param ResponseEmitterInterface $emitter
     * @param ServerRequestFactoryInterface $requestFactory
     */
    public function __construct(
        MiddlewareDispatcherInterface $dispatcher,
        ResponseEmitterInterface $emitter,
        ServerRequestFactoryInterface $requestFactory
    ) {
        $this->dispatcher = $dispatcher;
        $this->emitter = $emitter;
        $this->requestFactory = $requestFactory;
    }

    /**
     * Run application with server request globals.
     */
    public function run()
    {
        $request = $this->requestFactory
            ->createServerRequest($_SERVER)
            ->withQueryParams($_GET);

        $this->send($this->handleRequest($request));
    }

    /**
     * @inheritdoc
     */
    public function addMiddleware(MiddlewareInterface $middleware)
    {
        $this->stack[] = $middleware;
    }

    /**
     * @inheritdoc
     */
    public function handleRequest(ServerRequestInterface $request)
    {
        return $this->dispatcher->dispatch($request, $this->stack);
    }

    /**
     * @inheritdoc
     */
    public function send(ResponseInterface $response)
{'fraction_non_alphanumeric': 0.10922836287799792, 'fraction_numerical': 0.0, 'mean_word_length': 3.034700315457413, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 26, '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': '599816', 'n_tokens_mistral': 1009, 'n_tokens_neox': 994, 'n_words': 197}