<commit_before><?php
/*
 * This file is part of the ************************ package.
 * _____________                           _______________
 *  ______/     \__  _____  ____  ______  / /_  _________
 *   ____/ __   / / / / _ \/ __`\/ / __ \/ __ \/ __ \___
 *    __/ / /  / /_/ /  __/ /  \  / /_/ / / / / /_/ /__
 *      \_\ \_/\____/\___/_/   / / .___/_/ /_/ .___/
 *         \_\                /_/_/         /_/
 *
 * The PHP Framework For Code Poem As Free As Wind. <Query Yet Simple>
 * (c) 2010-2018 http://queryphp.com All rights reserved.
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */
namespace Queryyetsimple\Session\Middleware;

use Closure;
use Queryyetsimple\{
    Http\Request,
    Http\Response,
    Session\Manager
};

/**
 * Session 中间件
 *
 * @author <NAME> <<EMAIL>>
 * @package $$
 * @since 2017.11.14
 * @version 1.0
 */
class Session
{

    /**
     * session 管理
     *
     * @var \Queryyetsimple\Session\Manager
     */
    protected $manager;

    /**
     * 构造函数
     *
     * @param \queryyetsimple\Session\Manager $manager
     * @return void
     */
    public function __construct(Manager $manager)
    {
        $this->manager = $manager;
    }

    /**
     * 请求
     *
     * @param \Closure $next
     * @param \Queryyetsimple\Http\Request $request
     * @return void
     */
    public function handle(Closure $next, Request $request)
    {
        $this->startSession();
        $next($request);
    }

    /**
     * 响应
     *
     * @param \Closure $next
     * @param \Queryyetsimple\Http\Request $request
     * @param \Queryyetsimple\Http\Response $response
     * @return void
     */
    public function terminate(Closure $next, Request $request, Response $response)
    {
        $this->unregisterFlash();
        $this->setPrevUrl($request);
        $next($request, $response);
    }

    /**
     * 启动 session
     *
     * @return void
     */
    protected function startSession()
    {
        $this->manager->start();
    }

    /**
     * 清理闪存
     *
     * @return void
     */
    protected function unregisterFlash()
    {
        $this->manager->unregisterFlash();
    }

    /**
     * 保存当期请求 URL
     *
     * @param \Queryyetsimple\Http\Request $request
     * @return void
     */
    protected function setPrevUrl(Request $request)
    {
        $this->manager->setPrevUrl($request->getUri());
    }
}
<commit_msg>update composer<commit_after><?php
/*
 * This file is part of the ************************ package.
 * _____________                           _______________
 *  ______/     \__  _____  ____  ______  / /_  _________
 *   ____/ __   / / / / _ \/ __`\/ / __ \/ __ \/ __ \___
 *    __/ / /  / /_/ /  __/ /  \  / /_/ / / / / /_/ /__
 *      \_\ \_/\____/\___/_/   / / .___/_/ /_/ .___/
 *         \_\                /_/_/         /_/
 *
 * The PHP Framework For Code Poem As Free As Wind. <Query Yet Simple>
 * (c) 2010-2018 http://queryphp.com All rights reserved.
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */
namespace Queryyetsimple\Session\Middleware;

use Closure;
use Queryyetsimple\{
    Http\Request,
    Http\Response,
    Session\Manager
};

/**
 * Session 中间件
 *
 * @author <NAME> <<EMAIL>>
 * @package $$
 * @since 2017.11.14
 * @version 1.0
 */
class Session
{

    /**
     * session 管理
     *
     * @var \Queryyetsimple\Session\Manager
     */
    protected $manager;

    /**
     * 构造函数
     *
     * @param \Queryyetsimple\Session\Manager $manager
     * @return void
     */
    public function __construct(Manager $manager)
    {
        $this->manager = $manager;
    }

    /**
     * 请求
     *
     * @param \Closure $next
     * @param \Queryyetsimple\Http\Request $request
     * @return void
     */
    public function handle(Closure $next, Request $request)
    {
        $this->startSession();
        $next($request);
    }

    /**
     * 响应
     *
     * @param \Closure $next
     * @param \Queryyetsimple\Http\Request $request
     * @param \Queryyetsimple\Http\Response $response
     * @return void
     */
    public function terminate(Closure $next, Request $request, Response $response)
    {
        $this->unregisterFlash();
        $this->setPrevUrl($request);
        $next($request, $response);
    }

    /**
     * 启动 session
     *
     * @return void
     */
    protected function startSession()
    {
        $this->manager->start();
    }

    /**
     * 清理闪存
     *
     * @return void
     */
    protected function unregisterFlash()
    {
        $this->manager->unregisterFlash();
    }

    /**
     * 保存当期请求 URL
     *
     * @param \Queryyetsimple\Http\Request $request
     * @return void
     */
    protected function setPrevUrl(Request $request)
    {
        $this->manager->setPrevUrl($request->getUri());
    }
}

{'fraction_non_alphanumeric': 0.15097402597402598, 'fraction_numerical': 0.007305194805194805, 'mean_word_length': 1.7444320712694878, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 33, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 2, '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': '198623', 'n_tokens_mistral': 1670, 'n_tokens_neox': 1591, 'n_words': 307}