public function formatName($format = UserInterface::NAME_FULL)
    {
        $first_name = $this->getFirstName();
        $last_name = $this->getLastName();

        if (empty($first_name) && empty($last_name)) {
            list($first_name, $last_name) = $this->getFirstAndLastNameFromEmail();
        }

        if ($format == UserInterface::NAME_FULL) {
            return trim($first_name . ' ' . $last_name);
        } else {
            if ($format == UserInterface::NAME_SHORT_LAST_NAME) {
                return $this->getLastName() ? trim($this->getFirstName() . ' ' . mb_substr($this->getLastName(), 0, 1) . '.') : $this->getFirstName();
            } elseif ($format == UserInterface::NAME_SHORT_FIRST_NAME) {
                return $this->getFirstName() ? trim(mb_substr($this->getFirstName(), 0, 1) . '.' . ' ' . $this->getLastName()) : $this->getLastName();
            } else {
                return mb_substr($first_name, 0, 1) . mb_substr($last_name, 0, 1);
            }
        }
    }