public static function isValid($user)
    {
        if (Yii::$app instanceof \yii\web\Application && !Yii::$app->user->isGuest)
        {
            return Yii::$app->user->identity;
        }
        if (!($user instanceof static)) {
            return false;
        }
        return $user->find()->guid($user)->exists() ? $user : false;
    }
public static function isValid($user)
    {
        if (Yii::$app instanceof \yii\web\Application && !Yii::$app->user->isGuest)
        {
            return Yii::$app->user->identity;
        }
        if (!($user instanceof static)) {
            return false;
        }
        return $user->find()->guid($user)->exists() ? $user : false;
    }
public static function isValid ( $ user ) { if ( Yii :: $ app instanceof \ yii \ web \ Application && ! Yii :: $ app -> user -> isGuest ) { return Yii :: $ app -> user -> identity ; } if ( ! ( $ user instanceof static ) ) { return false ; } return $ user -> find ( ) -> guid ( $ user ) -> exists ( ) ? $ user : false ; }
Check whether the user is valid.
@param static $user User instance. The current logged-in user is automatically
used if a user is logged in and this parameter is null.
@return static|false if current user is valid, it return as is, otherwise
false returned.
@throws InvalidParamException if the current user is not logged in and
the user is not a valid instance.
Check whether the user is valid .