<commit_before><?php
/**
 * Identity and Access Management server providing OAuth2, multi-factor authentication and more
 *
 * @link      https://github.com/hiqdev/hiam
 * @package   hiam
 * @license   BSD-3-Clause
 * @copyright Copyright (c) 2014-2017, HiQDev (http://hiqdev.com/)
 */

namespace hiam\base;

use hiam\models\Identity;
use yii\authclient\ClientInterface;
use yii\web\IdentityInterface;
use Yii;

class User extends \yii\web\User
{
    public $storageClasses = [];

    public $remoteUserClass;

    public $disableSignup = false;

    public $disableRestorePassword = false;

    public $loginDuration = 3600 * 24 * 31;

    public function login(IdentityInterface $identity, $duration = null)
    {
        return parent::login($identity, $duration ?? $this->loginDuration);
    }

    /**
     * Registers new user.
     * @return Identity|null the saved identity or null if saving fails
     */
    public function signup(User $model)
    {
        if (!$model->validate()) {
            return null;
        }
        $class = $this->identityClass;
        $user = new $class();
        $user->setAttributes($model->getAttributes());
        $user->username = $model->username ?? $model->email;
        $ok = $user->save();

        if ($user->save()) {
            $this->notifySignup($user);
            return $user;
        }

        return null;
    }

    protected function notifySignup($user)
    {
        $params = Yii::$app->params;

        return Yii::$app->mailer->compose()
            ->renderHtmlBody('userSignup', compact('user'))
            ->setTo($params['signupEmail'] ?? $params['supportEmail'] ?? $params['adminEmail'])
            ->send();
    }<commit_msg>Fixed wrong type check<commit_after><?php
/**
 * Identity and Access Management server providing OAuth2, multi-factor authentication and more
 *
 * @link      https://github.com/hiqdev/hiam
 * @package   hiam
 * @license   BSD-3-Clause
 * @copyright Copyright (c) 2014-2017, HiQDev (http://hiqdev.com/)
 */

namespace hiam\base;

use hiam\models\Identity;
use yii\authclient\ClientInterface;
use yii\web\IdentityInterface;
use Yii;

class User extends \yii\web\User
{
    public $storageClasses = [];

    public $remoteUserClass;

    public $disableSignup = false;

    public $disableRestorePassword = false;

    public $loginDuration = 3600 * 24 * 31;

    public function login(IdentityInterface $identity, $duration = null)
    {
        return parent::login($identity, $duration ?? $this->loginDuration);
    }

    /**
     * Registers new user.
     * @return Identity|null the saved identity or null if saving fails
     */
    public function signup($model)
    {
        if (!$model->validate()) {
            return null;
        }
        $class = $this->identityClass;
        $user = new $class();
        $user->setAttributes($model->getAttributes());
        $user->username = $model->username ?? $model->email;
        $ok = $user->save();

        if ($user->save()) {
            $this->notifySignup($user);
            return $user;
        }

        return null;
    }

    protected function notifySignup($user)
    {
        $params = Yii::$app->params;

        return Yii::$app->mailer->compose()
            ->renderHtmlBody('userSignup', compact('user'))
            ->setTo($params['signupEmail'] ?? $params['supportEmail'] ?? $params['adminEmail'])
            ->send();
    }
{'fraction_non_alphanumeric': 0.14411247803163443, 'fraction_numerical': 0.01054481546572935, 'mean_word_length': 2.553590010405827, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 37, 'https://': 2, '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': '7613910', 'n_tokens_mistral': 1022, 'n_tokens_neox': 982, 'n_words': 232}