Return display name of this user.

@param  string $format
@return string
557222
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);
            }
        }
    }
840655
static public function udate($format)
	{
		$utimestamp = microtime(true);

		$usec = round(1000 * 1000 * ($utimestamp - floor($utimestamp)));

		return date(str_replace('u', $usec, $format), $utimestamp);
	}
950625
public function parseCustomFormat($format)
    {
        if (isset($this->parsedFormats[$format])) {
            return $this->parsedFormats[$format];
        }

        return $this->parsedFormats[$format] = $this->parseFormat($format);
    }
768356
public function getMediaUrl($mediaId, $format)
    {
        $media = $this->getMedia($mediaId);

        if ($media) {
            return $this->displayMediaManager->getMediaFormatUrl($media, $format);
        }

        return '';
    }
1284254
public function format($format)
    {
        $string = str_replace(' ', '', $this->value());
        for ($i = 0; $i < strlen($string); $i++) {
            $pos = strpos($format, '#');

            // verificar se string eh maior que a qtdade de #.
            if ($pos === false) {
                break;
            }
            $format[$pos] = $string[$i];
        }

        // verificar se sobrou # para trocar
        if (strpos($format, '#') !== false) {
            $format = $this->value();
        }

        $this->value = $format;

        return $this;
    }
1217541
public function format($format)
    {
        $format = str_replace('u', sprintf('%06d', $this->microseconds), $format);

        return parent::format($format);
    }
705525
public function getComment($format)
    {
        return implode("\n", Comment::wrap(strtr($this->getCommentFormat(), $this->getCommentVars()), $format));
    }
116598
public function toString(string $format = null): string
    {
        if (isset($format)) {
            return (new DateTime('@0'))
                ->diff(new DateTime('@'.round($this->time, 0)))
                ->format($format);
        }
        return $this->__toString();
    }
317199
public static function getDatePlaceholder(string $format) : string {
		$format = str_replace('Y', 'YYYY', $format);
		$format = str_replace('m', 'MM', $format);
		$format = str_replace('d', 'DD', $format);
		$format = str_replace('H', 'HH', $format);
		$format = str_replace('i', 'MM', $format);
		$format = str_replace('s', 'SS', $format);
		$format = str_replace('g', 'HH', $format);
		$format = str_replace('a', 'am', $format);
		$format = str_replace('u', '000000', $format);
		return $format;
	}
692725
public function format($format)
    {
        $format = str_replace('%U', sprintf("%06d", $this->u), $format);
        $format = str_replace('%u', sprintf("%d", intval($this->u)), $format);

        return parent::format($format);
    }
627194
public function format(string $format) : string
    {
        // Replace microseconds first so they become literals.
        // Ignore any escaped microsecond identifiers.
        $format = preg_replace_callback(
            // Starting at the start of the string or the first non % character,
            // consume pairs of % characters (effectively consuming all escaped %s)
            // and finally match the string %u.
            '/((?:^|[^%])(?:%{2})*)(%u)/',
            function (array $matches) {
                return $matches[1] . $this->microseconds;
            },
            $format
        );

        $format = $this->wrapped->format($format);
        
        return $format;
    }
1090329
public function getViewFileName($format = null, $vars = array())
    {
        if (0 === strlen($filename = $this->getDocument()->translateFilename($format, $this, $vars)))
        {
            $filename = implode('.', array($this->getSchema()->getName(), $this->getRawViewName(), $this->getFormatter()->getFileExtension()));
        }

        return $filename;
    }
419749
public function getImage(string $format = null) : string
    {
        if (!$format) {
            $format = $this->instance->getImageFormat();
        }
        switch (strtolower($format)) {
            case 'jpg':
            case 'jpeg':
                $this->instance->setImageFormat('jpg');
                break;
            case 'bitmap':
            case 'bmp':
                $this->instance->setImageFormat('bmp');
                break;
            case 'png':
                $this->instance->setImageFormat('png');
                break;
            case 'gif':
                $this->instance->setImageFormat('gif');
                break;
            case 'webp':
                $this->instance->setImageFormat('webp');
                break;
            default:
                throw new ImageException('Unsupported format');
        }
        return $this->instance->getImageBlob();
    }
535962
public function format($format)
    {
        $format = preg_replace_callback('/(?<!\\\\)[DlFM]/', array($this, '_translate'), $format);
        return $this->_date->format($format);
    }
1273811
public function format($format = null) {
        if(is_null($format)) {
            $format = $this->getFormatter()->getCurrentFormat();
        }
        return date($format, $this->getEpoch());
    }
745647
public function getRawRequestResponse($format)
    {
        $result = '';
        if ($this->getRawRequest() !== null || $this->getRawResponse() !== null) {
            $messages = array();
            if ($this->getRawRequest() !== null) {
                $messages[] = $this->t('message_sent') . ":\n" . $this->getRawRequest();
            }
            if ($this->getRawResponse() !== null) {
                $messages[] = $this->t('message_received') . ":\n" . $this->getRawResponse();
            }
            $result .= $this->formatMessages($messages, $format);
        }
        return $result;
    }
1296013
protected static function parseFormat($format)
    {
        static::loadFormats();

        // If the format equals a constant's value, just return it.
        if (in_array($format, static::$formats, true)) {
            return $format;
        }

        // Otherwise we'll assume the format is the constant's name.
        return Arr::get(static::$formats, strtoupper($format));
    }