<commit_before><?php

/*
 * This file is part of the symfony package.
 * ( c ) 2004-2006 <NAME> <<EMAIL>>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

/**
 *
 * @package        symfony
 * @subpackage plugin
 * @author         <NAME> <<EMAIL>>
 * @version        SVN: $Id: sfGuardSecurityUser.class.php 3187 2007-01-08 10:51:03Z fabien $
 */
class sfGuardSecurityUser extends sfBasicSecurityUser
{
    private $user = null;

    public function hasCredential( $credential, $useAnd = true )
    {
        if ( !$this->getGuardUser() )
        {
            return false;
        }

        if ( $this->getGuardUser()->getIsSuperAdmin() )
        {
            return true;
        }

        return parent::hasCredential( $credential, $useAnd );
    }

		public function getUsername()
		{
			return $this->getAttribute('username', null, 'sfGuardSecurityUser');
		}

    public function isAnonymous()
    {
        return $this->getAttribute( 'user_id', null, 'sfGuardSecurityUser' ) ? false : true;
    }

    public function signIn( $user, $remember = false )
    {
        // signin
        $this->setAttribute( 'user_id', $user->get('id'), 'sfGuardSecurityUser' );
        $this->setAttribute( 'username', $user->get('username'), 'sfGuardSecurityUser' );
				$this->setAuthenticated( true );
        $this->clearCredentials();
        $this->addCredentials( $user->getAllPermissionNames() );

        // Get a new date formatter
        $dateFormat = new sfDateFormat();

        // save last login
        $current_time_value = $dateFormat->format( time(), 'I' );
        $user->set('last_login', $current_time_value );
        $user->save();

        // remember?
        if ( $remember )
        {
            // remove old keys<commit_msg>fixed #1772 and very small CS cleanup<commit_after><?php

/*
 * This file is part of the symfony package.
 * ( c ) 2004-2006 <NAME> <<EMAIL>>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

/**
 *
 * @package        symfony
 * @subpackage plugin
 * @author         <NAME> <<EMAIL>>
 * @version        SVN: $Id: sfGuardSecurityUser.class.php 3187 2007-01-08 10:51:03Z fabien $
 */
class sfGuardSecurityUser extends sfBasicSecurityUser
{
    protected $user = null;

    public function hasCredential( $credential, $useAnd = true )
    {
        if ( !$this->getGuardUser() )
        {
            return false;
        }

        if ( $this->getGuardUser()->getIsSuperAdmin() )
        {
            return true;
        }

        return parent::hasCredential( $credential, $useAnd );
    }

    public function getUsername()
    {
        return $this->getAttribute('username', null, 'sfGuardSecurityUser');
    }

    public function isAnonymous()
    {
        return $this->getAttribute( 'user_id', null, 'sfGuardSecurityUser' ) ? false : true;
    }

    public function signIn( $user, $remember = false )
    {
        // signin
        $this->setAttribute( 'user_id', $user->get('id'), 'sfGuardSecurityUser' );
        $this->setAttribute( 'username', $user->get('username'), 'sfGuardSecurityUser' );
        $this->setAuthenticated( true );
        $this->clearCredentials();
        $this->addCredentials( $user->getAllPermissionNames() );

        // Get a new date formatter
        $dateFormat = new sfDateFormat();

        // save last login
        $current_time_value = $dateFormat->format( time(), 'I' );
        $user->set('last_login', $current_time_value );
        $user->save();

        // remember?
        if ( $remember )
        {
            // remove old keys
{'fraction_non_alphanumeric': 0.13615529792396872, 'fraction_numerical': 0.015098409274737126, 'mean_word_length': 2.4099264705882355, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 47, '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': '352454', 'n_tokens_mistral': 1129, 'n_tokens_neox': 1068, 'n_words': 271}