src/PServerPanel/Service/UserAlias.php
public function getUserAlias4User(UserInterface $user)
    {
        if (!isset($this->userAliasCache[$user->getUsername()])) {
            $userAliasEntityTmp = $this->getUserAliasEntity4User($user);
            // workaround for the isset check, null would be false, so we have to set false=)
            if (!$userAliasEntityTmp) {
                $userAliasEntityTmp = false;
            }
            $this->userAliasCache[$user->getUsername()] = $userAliasEntityTmp;
        }

        $userAliasEntity = $this->userAliasCache[$user->getUsername()];

        if ($userAliasEntity) {
            $result = $userAliasEntity->getCharName();
        } else {
            $result = $user->getUsername();
        }

        return $result;
    }
public function getUserAlias4User(UserInterface $user)
    {
        if (!isset($this->userAliasCache[$user->getUsername()])) {
            $userAliasEntityTmp = $this->getUserAliasEntity4User($user);
            // workaround for the isset check, null would be false, so we have to set false=)
            if (!$userAliasEntityTmp) {
                $userAliasEntityTmp = false;
            }
            $this->userAliasCache[$user->getUsername()] = $userAliasEntityTmp;
        }

        $userAliasEntity = $this->userAliasCache[$user->getUsername()];

        if ($userAliasEntity) {
            $result = $userAliasEntity->getCharName();
        } else {
            $result = $user->getUsername();
        }

        return $result;
    }
return the alias of a user, ot the username, as default

@param UserInterface $user
@return int|string