getFormatClass

@param string $format

@return  string|\Windwalker\Structure\Format\FormatInterface

@throws  \DomainException

@since   2.1
171556
public static function getFormatClass($format)
    {
        // Return a namespace in a given format
        $class = sprintf('%s\Format\%sFormat', __NAMESPACE__, ucfirst(strtolower($format)));

        if (!class_exists($class)) {
            throw new \DomainException(
                sprintf(
                    'Structure format: %s not supported. Class: %s not found.',
                    $format,
                    $class
                )
            );
        }

        return $class;
    }
716303
public function getFormatWebPath($format = null)
    {
        if (!$format = $format ?: $this->defaultFormat) {
            return $this->getWebPath();
        }

        return ($formattedImage = $this->getFormattedImage($format))
            ? $formattedImage->getWebPath()
            : $this->getWebPath()
        ;
    }
257176
public function format(string $format) : string
    {
        $format = $this->escapeUnapplicableFormatChars($format);

        return $this->dateTime->format($format);
    }
535962
public function format($format)
    {
        $format = preg_replace_callback('/(?<!\\\\)[DlFM]/', array($this, '_translate'), $format);
        return $this->_date->format($format);
    }
1255647
public static function getOutputFormatter( $format )
    {
        if ( !self::isRegisteredFormatter( $format ) )
        {
            $format = eZINI::instance( 'template.ini' )->variable( 'AttributeOperator', 'DefaultFormatter' );
        }

        if ( !( self::$formatter instanceof ezpAttributeOperatorFormatterInterface ) || $format != self::$format )
        {
            self::$formatter = self::createFormatter( $format );
            self::$format = $format;
        }

        return self::$formatter;
    }
942612
public function format($format = null)
    {
        if ($format !== null) {
            $this->format = $format;
        }

        return $this->format;
    }
335087
public function emailFormat($format = null)
    {
        deprecationWarning('Email::emailFormat() is deprecated. Use Email::setEmailFormat() or Email::getEmailFormat() instead.');

        if ($format === null) {
            return $this->getEmailFormat();
        }

        return $this->setEmailFormat($format);
    }
996501
public function format(int $format) : string
    {
        return PhoneNumberUtil::getInstance()->format($this->phoneNumber, $format);
    }
15965
public function getFileSetDisplayName($format = 'html')
    {
        $value = tc('FileSetName', $this->getFileSetName());
        switch ($format) {
            case 'html':
                return h($value);
            case 'text':
            default:
            return $value;
        }
    }
728259
public function format($format = '')
    {
        if ($this->isHollow()) {
            $format = $this->format;
        } else {
            $format = $format ?: $this->format;
        }

        return parent::format($format);
    }
710825
public function toString($format = null) {
        // If no format is defined, use the one specified in the current class
        if (!isset($format)) {
            $format = self::DATETIME_FORMAT;
        }

        return $this->_dateTime->format($format) . '.' . self::_formatMilliseconds($this->_milliseconds);
    }
1268979
function getSubjectDN($format = FILE_X509_DN_ARRAY)
    {
        switch (true) {
            case !empty($this->dn):
                return $this->getDN($format);
            case !isset($this->currentCert) || !is_array($this->currentCert):
                break;
            case isset($this->currentCert['tbsCertificate']):
                return $this->getDN($format, $this->currentCert['tbsCertificate']['subject']);
            case isset($this->currentCert['certificationRequestInfo']):
                return $this->getDN($format, $this->currentCert['certificationRequestInfo']['subject']);
        }

        return false;
    }
836431
public function format($format)
    {
        // Sprintf and unit regex
        $pattern = '/(%(?:\d+\$)?[+-]?(?:[ 0]|\'.{1})?-?\d*(?:\.\d+)?[bcdeEufFgGosxX])(.*)/';

        // Check if string has sprintf and unit...
        if (preg_match_all($pattern, $format, $m)) {
            // Valid format, save to instance.
            $this->format = $format;

            // Get sprintf and units
            $sprintf = $m[1][0];
            $unit    = $m[2][0];

            // Try to find value of instance at specified units.
            $value = $this->{trim($unit)};
            if ($value == 0) {
                $value = $this->{strtolower(trim($unit))};
                if ($value == 0) {
                    $value = $this->{strtoupper(trim($unit))};
                }
            }

            // Should just display as scientific notation?
            if (sprintf($sprintf, $value) == 0 || $value > 10e9) {
                // Change sprintf to use e for scientific notation
                $sprintf = preg_replace('/[bcdeEufFgGosxX]/', 'e', $sprintf);
            }

            // Return value with format and unit suffix.
            return sprintf($sprintf, $value) . $unit;
        } else {
            // No valid format found, use old format.
            if (preg_match_all($pattern, $this->format, $m)) {
                return $this->format(
                  str_replace(trim($m[2][0]), '', $m[0][0]) . $format);
            }
        }
    }
839036
final public function format($format)
    {
        if(is_null($this->value)) {
            return null;
        } else {
            return $this->value->format($format);
        }
    }
430347
public function getCode($format)
    {
        foreach ($this->codes as $code) {
            if ($code->getFormat() == $format) {
                return $code;
            }
        }
    }
348170
public function getFormat($name)
    {
        if (empty($this->formats[$name]) || !($this->formats[$name] instanceof FormatInterface)) {
            $class = sprintf('Windwalker\\Language\\Format\\%sFormat', $name);

            if (!class_exists($class)) {
                throw new \DomainException('Format ' . $name . ' not support. Class: ' . $class . ' not found');
            }

            $this->formats[$name] = new $class();
        }

        return $this->formats[$name];
    }
727797
protected function getContentType($format)
    {
        // Check if it's already MIME
        if (\Jasny\str_contains($format, '/')) {
            return $format;
        }
        
        $repository = new ApacheMimeTypes();
        $mime = $repository->findType($format);

        if (!isset($mime)) {
            throw new \UnexpectedValueException("Format '$format' doesn't correspond with a MIME type");
        }
        
        return $mime;
    }