<commit_before><?php
/**
 * Vision PHP-Framework
 *
 * @author <NAME> <<EMAIL>>
 * @copyright 2012-2016 <NAME>
 * @license http://www.opensource.org/licenses/mit-license.php MIT
 */
namespace Vision\Controller;

use Vision\Http\RequestInterface;
use Vision\Http\RequestAwareInterface;
use Vision\Http\ResponseInterface;
use Vision\Http\ResponseAwareInterface;
use Vision\Http\Url;

abstract class AbstractController implements RequestAwareInterface, ResponseAwareInterface,
                                             ControllerInterface
{
    /** @var RequestInterface $request */
    protected $request;

    /** @var ResponseInterface $response */
    protected $response;

    /**
     * This method will be called right after instantiating the controller.
     *
     * @return void
     */
    public function preFilter()
    {
    }

    /**
     * This method will be called right after invoking the controller action.
     *
     * @return void
     */
    public function postFilter()
    {
    }

    /**
     * @param RequestInterface $request
     *
     * @return $this Provides a fluent interface.
     */
    public function setRequest(RequestInterface $request)
    {
        $this->request = $request;
        return $this;
    }

    /**
     * @param ResponseInterface $response
     *
     * @return $this Provides a fluent interface.
     */
    public function setResponse(ResponseInterface $response)
    {
        $this->response = $response;
        return $this;
    }

    /**
     * This is a shorthand method for creating a redirect response.
     *
     * @param string $url
     * @param int $statusCode
     *
     * @return bool|ResponseInterface
     */
    public function redirect($url, $statusCode = 302)
    {
        $url = new Url($url);
        $url = $url->populateFromRequest($this->request)->build();

        if ($this->response === null || $url === false) {
            return false;
        }

        $this->response->addHeader('Location', $url)
                       ->setStatusCode($statusCode);

        return $this->response;
    }
}
<commit_msg>Do not longer implement deprecated interfaces<commit_after><?php
/**
 * Vision PHP-Framework
 *
 * @author <NAME> <<EMAIL>>
 * @copyright 2012-2016 <NAME>
 * @license http://www.opensource.org/licenses/mit-license.php MIT
 */
namespace Vision\Controller;

use Vision\Http\RequestInterface;
use Vision\Http\ResponseInterface;
use Vision\Http\Url;

abstract class AbstractController implements ControllerInterface
{
    /** @var RequestInterface $request */
    protected $request;

    /** @var ResponseInterface $response */
    protected $response;

    /**
     * This method will be called right after instantiating the controller.
     *
     * @return void
     */
    public function preFilter()
    {
    }

    /**
     * This method will be called right after invoking the controller action.
     *
     * @return void
     */
    public function postFilter()
    {
    }

    /**
     * @param RequestInterface $request
     *
     * @return $this Provides a fluent interface.
     */
    public function setRequest(RequestInterface $request)
    {
        $this->request = $request;
        return $this;
    }

    /**
     * @param ResponseInterface $response
     *
     * @return $this Provides a fluent interface.
     */
    public function setResponse(ResponseInterface $response)
    {
        $this->response = $response;
        return $this;
    }

    /**
     * This is a shorthand method for creating a redirect response.
     *
     * @param string $url
     * @param int $statusCode
     *
     * @return bool|ResponseInterface
     */
    public function redirect($url, $statusCode = 302)
    {
        $url = new Url($url);
        $url = $url->populateFromRequest($this->request)->build();

        if ($this->response === null || $url === false) {
            return false;
        }

        $this->response->addHeader('Location', $url)
                       ->setStatusCode($statusCode);

        return $this->response;
    }
}

{'fraction_non_alphanumeric': 0.11184521000471921, 'fraction_numerical': 0.005191127890514393, 'mean_word_length': 1.9894217207334273, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 31, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '123959', 'n_tokens_mistral': 1185, 'n_tokens_neox': 1095, 'n_words': 291}