<commit_before><?php
namespace Uecode\Bundle\ApiKeyBundle\Security\Authentication\Provider;

use FOS\UserBundle\Security\UserProvider AS FOSUserProvider;
use Symfony\Component\Security\Core\Exception\UnsupportedUserException;
use Symfony\Component\Security\Core\User\UserInterface as SecurityUserInterface;

/**
 * @author <NAME> <<EMAIL>>
 */
class UserProvider extends FOSUserProvider
{
    /**
     * @var bool Stateless Authentication?
     */
    private $stateless = false;

    /**
     * @param $apiKey
     *
     * @return UserInterface
     */
    public function loadUserByApiKey($apiKey)
    {
        $this->stateless = true;

        return $this->userManager->findUserBy(['apiKey' => $apiKey]);
    }

    /**
     * @param SecurityUserInterface $user
     *
     * @return SecurityUserInterface
     * @throws UnsupportedUserException
     */
    public function refreshUser(SecurityUserInterface $user)
    {
        if ($this->stateless) {
            throw new UnsupportedUserException();
        }
        return parent::refreshUser($user);
    }
}
<commit_msg>remove PHP5.4 requirements<commit_after><?php
namespace Uecode\Bundle\ApiKeyBundle\Security\Authentication\Provider;

use FOS\UserBundle\Security\UserProvider AS FOSUserProvider;
use Symfony\Component\Security\Core\Exception\UnsupportedUserException;
use Symfony\Component\Security\Core\User\UserInterface as SecurityUserInterface;

/**
 * @author <NAME> <<EMAIL>>
 */
class UserProvider extends FOSUserProvider
{
    /**
     * @var bool Stateless Authentication?
     */
    private $stateless = false;

    /**
     * @param $apiKey
     *
     * @return UserInterface
     */
    public function loadUserByApiKey($apiKey)
    {
        $this->stateless = true;

        return $this->userManager->findUserBy(array('apiKey' => $apiKey));
    }

    /**
     * @param SecurityUserInterface $user
     *
     * @return SecurityUserInterface
     * @throws UnsupportedUserException
     */
    public function refreshUser(SecurityUserInterface $user)
    {
        if ($this->stateless) {
            throw new UnsupportedUserException();
        }
        return parent::refreshUser($user);
    }
}

{'fraction_non_alphanumeric': 0.11319890009165903, 'fraction_numerical': 0.0009165902841429881, 'mean_word_length': 3.0276752767527677, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 19, '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': '1568986', 'n_tokens_mistral': 616, 'n_tokens_neox': 613, 'n_words': 116}