<commit_before><?php
namespace Scheb\TwoFactorBundle\Security\Http\EntryPoint;

use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Security\Core\Exception\AuthenticationException;
use Symfony\Component\Security\Http\EntryPoint\AuthenticationEntryPointInterface;
use Symfony\Component\Security\Http\HttpUtils;

class TwoFactorAuthenticationEntryPoint implements AuthenticationEntryPointInterface
{
    /**
     * @var string
     */
    private $authFormPath;

    /**
     * @var HttpUtils
     */
    private $httpUtils;

    /**
     * @param HttpUtils  $httpUtils  An HttpUtils instance
     * @param string     $loginPath  The path to the login form
     */
    public function __construct(HttpUtils $httpUtils, $loginPath)
    {
        $this->httpUtils = $httpUtils;
        $this->authFormPath = $loginPath;
    }

    /**
     * {@inheritdoc}
     */
    public function start(Request $request, AuthenticationException $authException = null)
    {
        return $this->httpUtils->createRedirectResponse($request, $this->authFormPath);
    }

    /**
     * If current request already displays the entry point
     *
     * @param Request $request
     *
     * @return bool
     */
    public function isAuthFormRequest(Request $request)
    {
        return $request->getPathInfo() === $this->authFormPath;
    }
}<commit_msg>Use HttpUtils checkRequestPath<commit_after><?php
namespace Scheb\TwoFactorBundle\Security\Http\EntryPoint;

use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Security\Core\Exception\AuthenticationException;
use Symfony\Component\Security\Http\EntryPoint\AuthenticationEntryPointInterface;
use Symfony\Component\Security\Http\HttpUtils;

class TwoFactorAuthenticationEntryPoint implements AuthenticationEntryPointInterface
{
    /**
     * @var string
     */
    private $authFormPath;

    /**
     * @var HttpUtils
     */
    private $httpUtils;

    /**
     * @param HttpUtils  $httpUtils  An HttpUtils instance
     * @param string     $loginPath  The path to the login form
     */
    public function __construct(HttpUtils $httpUtils, $loginPath)
    {
        $this->httpUtils = $httpUtils;
        $this->authFormPath = $loginPath;
    }

    /**
     * {@inheritdoc}
     */
    public function start(Request $request, AuthenticationException $authException = null)
    {
        return $this->httpUtils->createRedirectResponse($request, $this->authFormPath);
    }

    /**
     * If current request already displays the entry point
     *
     * @param Request $request
     *
     * @return bool
     */
    public function isAuthFormRequest(Request $request)
    {
        return $this->httpUtils->checkRequestPath($request, $this->authFormPath);
    }
}
{'fraction_non_alphanumeric': 0.10324699014958044, 'fraction_numerical': 0.0, 'mean_word_length': 3.123308270676692, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 18, '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': '5935075', 'n_tokens_mistral': 750, 'n_tokens_neox': 742, 'n_words': 158}