<commit_before><?php

namespace LosMiddleware\LosLog;

use Psr\Http\Message\ServerRequestInterface as Request;
use Psr\Http\Message\ResponseInterface as Response;
use Zend\Stratigility\ErrorMiddlewareInterface;
use Psr\Log\LoggerInterface;

class LosLog implements ErrorMiddlewareInterface
{
    private $logger;

    public function __construct(LoggerInterface $logger)
    {
        $this->logger = $logger;
    }

    public function __invoke($error, Request $request, Response $response, callable $next = null)
    {
        if ($error instanceof \Exception) {
            $this->logger->error($error->getMessage());
        }

        if ($next !== null) {
            return $next($request, $response);
        }

        return $response;
    }<commit_msg>bring $error in 3rd parameter in $next for LosLog<commit_after><?php

namespace LosMiddleware\LosLog;

use Psr\Http\Message\ServerRequestInterface as Request;
use Psr\Http\Message\ResponseInterface as Response;
use Zend\Stratigility\ErrorMiddlewareInterface;
use Psr\Log\LoggerInterface;

class LosLog implements ErrorMiddlewareInterface
{
    private $logger;

    public function __construct(LoggerInterface $logger)
    {
        $this->logger = $logger;
    }

    public function __invoke($error, Request $request, Response $response, callable $next = null)
    {
        if ($error instanceof \Exception) {
            $this->logger->error($error->getMessage());
        }

        if ($next !== null) {
            return $next($request, $response, $error);
        }

        return $response;
    }
{'fraction_non_alphanumeric': 0.10828025477707007, 'fraction_numerical': 0.0006369426751592356, 'mean_word_length': 3.1560846560846563, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 11, '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': '295328', 'n_tokens_mistral': 430, 'n_tokens_neox': 426, 'n_words': 109}