<commit_before><?php

namespace G4\CleanCore\UseCase;

use G4\CleanCore\Response\Response;
use G4\CleanCore\Request\Request;
use G4\CleanCore\UseCase\UseCaseInterface;

abstract class UseCaseAbstract implements UseCaseInterface
{
    /**
     * @var Request
     */
    private $_request;

    /**
     *
     * @var Response
     */
    private $_response;

    private $_formatter;

    public function __construct()
    {
        $this->setResponse(new Response());
    }

    /**
     * @return \G4\CleanCore\Request\Request
     */
    public function getRequest()
    {
        return $this->_request;
    }

    /**
     * @return Response
     */
    public function getResponse()
    {
        if (method_exists($this, 'getFormatterInstance') && $this->_response->hasResponseObject()) {
            $formattedResource = $this->getFormatterInstance()
                ->setResource($this->_response->getResponseObject())
                ->format();

            $this->_response->setResponseObject($formattedResource);
        }

        return $this->_response;
    }

    /**
     * @return \G4\CleanCore\Factory\UseCase
     */<commit_msg>Added forward() method in UseCaseAbstract<commit_after><?php

namespace G4\CleanCore\UseCase;

use G4\CleanCore\Response\Response;
use G4\CleanCore\Request\Request;
use G4\CleanCore\UseCase\UseCaseInterface;

abstract class UseCaseAbstract implements UseCaseInterface
{
    /**
     * @var Request
     */
    private $_request;

    /**
     *
     * @var Response
     */
    private $_response;

    private $_formatter;

    public function __construct()
    {
        $this->setResponse(new Response());
    }

    /**
     * @param string $useCaseName
     */
    public function forward($useCaseName)
    {
        $this->getResponse()->setResponseObject(
            $this->getUseCaseFactoryInstance()
            ->setUseCaseName($useCaseName)
            ->setRequest($this->getRequest())
            ->getResource());
    }

    /**
     * @return \G4\CleanCore\Request\Request
     */
    public function getRequest()
    {
        return $this->_request;
    }

    /**
     * @return Response
     */
    public function getResponse()
    {
        if (method_exists($this, 'getFormatterInstance') && $this->_response->hasResponseObject()) {
            $formattedResource = $this->getFormatterInstance()
                ->setResource($this->_response->getResponseObject())
                ->format();

            $this->_response->setResponseObject($formattedResource);
        }

        return $this->_response;
    }

    /**
     * @return \G4\CleanCore\Factory\UseCase
     */
{'fraction_non_alphanumeric': 0.13151927437641722, 'fraction_numerical': 0.0045351473922902496, 'mean_word_length': 2.247852760736196, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 34, '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': '498583', 'n_tokens_mistral': 749, 'n_tokens_neox': 727, 'n_words': 123}