public static function parseUserNick($userId = null, $onEmpty = 'guest'): ?string
    {
        if (!Any::isInt($userId)) {
            return \App::$Security->strip_tags($onEmpty);
        }

        // try to find user active record as object
        $identity = App::$User->identity($userId);
        if (!$identity) {
            return \App::$Security->strip_tags($onEmpty);
        }

        // return user nickname from profile
        return $identity->profile->getNickname();
    }
public static function parseUserNick($userId = null, $onEmpty = 'guest'): ?string
    {
        if (!Any::isInt($userId)) {
            return \App::$Security->strip_tags($onEmpty);
        }

        // try to find user active record as object
        $identity = App::$User->identity($userId);
        if (!$identity) {
            return \App::$Security->strip_tags($onEmpty);
        }

        // return user nickname from profile
        return $identity->profile->getNickname();
    }
public static function parseUserNick ( $ userId = null , $ onEmpty = 'guest' ) : ? string { if ( ! Any :: isInt ( $ userId ) ) { return \ App :: $ Security -> strip_tags ( $ onEmpty ) ; } // try to find user active record as object $ identity = App :: $ User -> identity ( $ userId ) ; if ( ! $ identity ) { return \ App :: $ Security -> strip_tags ( $ onEmpty ) ; } // return user nickname from profile return $ identity -> profile -> getNickname ( ) ; }
Get user nickname by user id with predefined value on empty or not exist profile
@param $userId
@param string $onEmpty
@return string
Get user nickname by user id with predefined value on empty or not exist profile